use of com.revolsys.ui.web.annotation.RequestAttribute in project com.revolsys.open by revolsys.
the class WebMethodHandler method requestAttribute.
public static WebParameterHandler requestAttribute(final WebAnnotationMethodHandlerAdapter adapter, final Parameter parameter, final Annotation annotation) {
final Class<?> parameterClass = parameter.getType();
final DataType dataType = DataTypes.getDataType(parameterClass);
final RequestAttribute requestAttribute = (RequestAttribute) annotation;
final String name = getName(parameter, requestAttribute.value());
final boolean required = requestAttribute.required();
final Object defaultValue = parseDefaultValueAttribute(dataType, requestAttribute.defaultValue());
return //
WebParameterHandler.function(//
name, (request, response) -> {
return request.getAttribute(name);
}, //
dataType, //
required, //
defaultValue);
}
Aggregations