本文整理匯總了Java中br.com.caelum.vraptor.controller.ControllerMethod.getMethod方法的典型用法代碼示例。如果您正苦於以下問題:Java ControllerMethod.getMethod方法的具體用法?Java ControllerMethod.getMethod怎麽用?Java ControllerMethod.getMethod使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類br.com.caelum.vraptor.controller.ControllerMethod
的用法示例。
在下文中一共展示了ControllerMethod.getMethod方法的5個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。
示例1: hasConstraints
import br.com.caelum.vraptor.controller.ControllerMethod; //導入方法依賴的package包/類
/**
* Only accepts if method isn't parameterless and have at least one constraint.
*/
private boolean hasConstraints(ControllerMethod controllerMethod) {
Method method = controllerMethod.getMethod();
if (method.getParameterTypes().length == 0) {
logger.debug("method {} has no parameters, skipping", controllerMethod);
return false;
}
BeanDescriptor bean = bvalidator.getConstraintsForClass(controllerMethod.getController().getType());
if(bean == null) {
return false;
}
MethodDescriptor descriptor = bean.getConstraintsForMethod(method.getName(), method.getParameterTypes());
return descriptor != null && descriptor.hasConstrainedParameters();
}
示例2: deserialize
import br.com.caelum.vraptor.controller.ControllerMethod; //導入方法依賴的package包/類
@Override
public Object[] deserialize(InputStream inputStream, ControllerMethod method) {
Method javaMethod = method.getMethod();
Class<?>[] types = javaMethod.getParameterTypes();
if (types.length == 0) {
throw new IllegalArgumentException("Methods that consumes xml must receive just one argument: the xml root element");
}
XStream xStream = getConfiguredXStream(javaMethod, types);
Object[] params = new Object[types.length];
chooseParam(types, params, xStream.fromXML(inputStream));
return params;
}
示例3: createTargets
import br.com.caelum.vraptor.controller.ControllerMethod; //導入方法依賴的package包/類
private List<Target<Object>> createTargets(ControllerMethod method) {
Method javaMethod = method.getMethod();
List<Target<Object>> targets = new ArrayList<>();
for (Parameter p : nameProvider.parametersFor(javaMethod)) {
Type type = p.getParameterizedType();
if (type instanceof TypeVariable) {
type = extractType(method, (TypeVariable<?>) type);
}
targets.add(new Target<>(type, p.getName()));
}
return targets;
}
示例4: createValuedParameter
import br.com.caelum.vraptor.controller.ControllerMethod; //導入方法依賴的package包/類
private void createValuedParameter(ControllerMethod controllerMethod) {
if (valuedParameters == null) {
valuedParameters = new ValuedParameter[controllerMethod.getArity()];
if (controllerMethod != null && controllerMethod.getMethod() != null) {
Parameter[] parameters = parameterNameProvider.parametersFor(controllerMethod.getMethod());
for (int i = 0; i < valuedParameters.length; i++) {
valuedParameters[i] = new ValuedParameter(parameters[i], null);
}
}
}
}
示例5: nameFor
import br.com.caelum.vraptor.controller.ControllerMethod; //導入方法依賴的package包/類
private String nameFor(ControllerMethod method) {
return KEY_START + method.getMethod();
}