List of usage examples for org.springframework.beans BeanUtils isSimpleProperty
public static boolean isSimpleProperty(Class<?> clazz)
From source file:org.springframework.web.method.annotation.ModelAttributeMethodProcessor.java
/** * Return {@code true} if there is a method-level {@code @ModelAttribute} * or, in default resolution mode, for any return value type that is not * a simple type.// ww w. ja va 2 s .co m */ @Override public boolean supportsReturnType(MethodParameter returnType) { return (returnType.hasMethodAnnotation(ModelAttribute.class) || (this.annotationNotRequired && !BeanUtils.isSimpleProperty(returnType.getParameterType()))); }
From source file:org.springframework.web.method.annotation.support.ModelAttributeMethodProcessor.java
/** * @return true if the parameter is annotated with {@link ModelAttribute} * or in default resolution mode also if it is not a simple type. *///from w w w . ja v a2 s . c o m public boolean supportsParameter(MethodParameter parameter) { if (parameter.hasParameterAnnotation(ModelAttribute.class)) { return true; } else if (this.annotationNotRequired) { return !BeanUtils.isSimpleProperty(parameter.getParameterType()); } else { return false; } }
From source file:org.springframework.web.method.annotation.support.ModelAttributeMethodProcessor.java
/** * Return {@code true} if there is a method-level {@code @ModelAttribute} * or if it is a non-simple type when {@code annotationNotRequired=true}. *//*from w ww .j a v a 2s.c o m*/ public boolean supportsReturnType(MethodParameter returnType) { if (returnType.getMethodAnnotation(ModelAttribute.class) != null) { return true; } else if (this.annotationNotRequired) { return !BeanUtils.isSimpleProperty(returnType.getParameterType()); } else { return false; } }
From source file:org.tinygroup.springmvc.support.ConventionRestfulWebArgumentResolver.java
@SuppressWarnings("unchecked") public Object resolveArgument(MethodParameter methodParameter, NativeWebRequest webRequest) throws Exception { if (!isConventionalRestful(webRequest)) { return UNRESOLVED; }/*w w w .j a v a 2 s . com*/ // and the paramName is id if (!StringUtils.equals("id", methodParameter.getParameterName())) { return UNRESOLVED; } Map<String, String> uriTemplateVariables = null; if (BeanUtils.isSimpleProperty(methodParameter.getParameterType())) { uriTemplateVariables = (Map<String, String>) webRequest .getAttribute(HandlerMapping.URI_TEMPLATE_VARIABLES_ATTRIBUTE, RequestAttributes.SCOPE_REQUEST); } if (uriTemplateVariables != null) { String val = uriTemplateVariables.get(methodParameter.getParameterName()); if (val != null && String.class.equals(methodParameter.getParameterType())) { return val; } else if (val != null) { PropertyEditor editor = getDefaultEditor(methodParameter.getParameterType()); if (editor != null) { editor.setAsText(val); return editor.getValue(); } } } return UNRESOLVED; }