@Retention(value=RUNTIME)
@Target(value=PARAMETER)
public @interface Optional
Alternatively, you can provide a default value using either the respecting values or a String value, a class and if needed a String methodName In the latter case it will search for a static method named methodName in the given class that uses a String as input parameter and uses a call to that method as default value.
| Modifier and Type | Optional Element and Description |
|---|---|
java.lang.Class<?> |
methodClass
If this is provided, then the default value will be a call to methodClass.methodName(String value)
|
java.lang.String |
methodName
Used to change the name of the method for optional method call
|
java.lang.String |
value
Value to be used as default.
|
boolean |
valueBoolean
Used for boolean parameters
|
double |
valueDouble
Used for float and double parameters
|
long |
valueLong
Used for int, short, long and byte parameters
|
public abstract java.lang.Class<?> methodClass
public abstract java.lang.String value
Can either be used on its own (for Strings) or together with the other two members (for all java Objects and primitives)