nu.staldal.lsp.framework
Annotation Type Parameter


@Documented
@Retention(value=RUNTIME)
@Target(value=FIELD)
public @interface Parameter

Mark a field in a ThrowawayService or EasyService with this annotation to set have it automatically populated with the value of a HTTP request parameter. The parameter name is the value argument, or the field name if the value argument is not set. The field must be public.

The field may be of any primitive type, any primitive wrapper type, String, or an Enum type.

If the parameter is not set (ServletRequest.getParameter(String) return null), the field is not set and retains its initial value. Unless the field has an Mandatory annotation, then a HTTP 400 BAD REQUEST error is generated.

If a parameter cannot be parsed as the type of the field, a HTTP 400 BAD REQUEST error is generated. For a char or java.lang.Character field, the first character of the parameter value is used.

Author:
Mikael Ståldal
See Also:
ServletRequest.getParameter(String)

Optional Element Summary
 java.lang.String value
          Parameter name.
 

value

public abstract java.lang.String value
Parameter name. Use field name if not set.

Returns:
parameter name
Default:
""