/** * Instantiate the model attribute from a URI template variable or from a * request parameter if the name matches to the model attribute name and * if there is an appropriate type conversion strategy. If none of these * are true delegate back to the base class. * @see #createAttributeFromRequestValue */ @Override protected final Object createAttribute(String attributeName, MethodParameter parameter, WebDataBinderFactory binderFactory, NativeWebRequest request) throws Exception { String value = getRequestValueForAttribute(attributeName, request); if (value != null) { Object attribute = createAttributeFromRequestValue( value, attributeName, parameter, binderFactory, request); if (attribute != null) { return attribute; } } return super.createAttribute(attributeName, parameter, binderFactory, request); }
/** * Instantiate the model attribute from a URI template variable or from a * request parameter if the name matches to the model attribute name and * if there is an appropriate type conversion strategy. If none of these * are true delegate back to the base class. * @see #createAttributeFromRequestValue */ @Override protected final Object createAttribute(String attributeName, MethodParameter parameter, WebDataBinderFactory binderFactory, NativeWebRequest request) throws Exception { String value = getRequestValueForAttribute(attributeName, request); if (value != null) { Object attribute = createAttributeFromRequestValue( value, attributeName, parameter, binderFactory, request); if (attribute != null) { return attribute; } } return super.createAttribute(attributeName, parameter, binderFactory, request); }
attribute = createAttribute(name, parameter, binderFactory, webRequest);
attribute = createAttribute(name, parameter, binderFactory, webRequest);
/** * Instantiate the model attribute from a URI template variable or from a * request parameter if the name matches to the model attribute name and * if there is an appropriate type conversion strategy. If none of these * are true delegate back to the base class. * @see #createAttributeFromRequestValue */ @Override protected final Object createAttribute(String attributeName, MethodParameter parameter, WebDataBinderFactory binderFactory, NativeWebRequest request) throws Exception { String value = getRequestValueForAttribute(attributeName, request); if (value != null) { Object attribute = createAttributeFromRequestValue( value, attributeName, parameter, binderFactory, request); if (attribute != null) { return attribute; } } return super.createAttribute(attributeName, parameter, binderFactory, request); }
@Override protected final Object createAttribute(String attributeName, MethodParameter methodParam, WebDataBinderFactory binderFactory, NativeWebRequest request) throws Exception { String value = getRequestValueForAttribute(attributeName, request); if (value != null) { Object attribute = createAttributeFromRequestValue(value, attributeName, methodParam, binderFactory, request); if (attribute != null) { return attribute; } } else { Class<?> parameterType = methodParam.getParameterType(); if (ClassUtils.isAssignable(Persistable.class, parameterType)) { String id = request.getParameter("id"); if (!Strings.isNullOrEmpty(id)) { return conversionService.convert(id, methodParam.getParameterType()); } else { Object repository = repositories.getRepositoryFor(parameterType); if (repository != null && repository instanceof DomainLifecycle) { return ((DomainLifecycle<?>) repository).initDomain(); } return parameterType.newInstance(); } } } return super.createAttribute(attributeName, methodParam, binderFactory, request); }
attribute = createAttribute(name, parameter, binderFactory, webRequest);
attribute = createAttribute(name, parameter, binderFactory, webRequest);