本文整理汇总了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();
}