@Retention(CLASS)
@Target({PARAMETER,METHOD})
@Repeatable(Fields.class)
@Documented
public @interface Field
Indicate that a method parameter value should be applied to a field on the resultant exception object.
If this annotation is placed on a method the name attribute becomes a required parameter and one default attribute needs to be set. The value of the default attribute is used to set the filed on the resultant exception object.
- Author:
- David M. Lloyd, James R. Perkins
-
Optional Element Summary
Modifier and TypeOptional ElementDescriptionboolean
The defaultboolean
value if this annotation is used on a method.byte
The default boolean value if this annotation is used on a method.char
The defaultbyte
value if this annotation is used on a method.Class
<?> The defaultClass
value if this annotation is used on a method.double
The defaultdouble
value if this annotation is used on a method.float
The defaultfloat
value if this annotation is used on a method.int
The defaultint
value if this annotation is used on a method.long
The defaultlong
value if this annotation is used on a method.The field name.short
The defaultshort
value if this annotation is used on a method.The defaultString
value if this annotation is used on a method.
-
Element Details
-
name
String nameThe field name. If not specified, the parameter name is assumed to be the field name.This becomes a required attrubyte if this annotation is present on a method.
- Returns:
- the field name
- Default:
""
-
booleanValue
boolean booleanValueThe defaultboolean
value if this annotation is used on a method.- Returns:
- the default value to use
- Default:
false
-
byteValue
byte byteValueThe default boolean value if this annotation is used on a method.- Returns:
- the default value to use
- Default:
(byte)0x00
-
charValue
char charValueThe defaultbyte
value if this annotation is used on a method.- Returns:
- the default value to use
- Default:
'\u0000'
-
classValue
Class<?> classValueThe defaultClass
value if this annotation is used on a method.- Returns:
- the default value to use
- Default:
java.lang.Object.class
-
doubleValue
double doubleValueThe defaultdouble
value if this annotation is used on a method.- Returns:
- the default value to use
- Default:
0.0
-
floatValue
float floatValueThe defaultfloat
value if this annotation is used on a method.- Returns:
- the default value to use
- Default:
0.0f
-
intValue
int intValueThe defaultint
value if this annotation is used on a method.- Returns:
- the default value to use
- Default:
0
-
longValue
long longValueThe defaultlong
value if this annotation is used on a method.- Returns:
- the default value to use
- Default:
0L
-
shortValue
short shortValueThe defaultshort
value if this annotation is used on a method.- Returns:
- the default value to use
- Default:
0
-
stringValue
String stringValueThe defaultString
value if this annotation is used on a method.- Returns:
- the default value to use
- Default:
""
-