@Retention(value=RUNTIME)
@Target(value=PARAMETER)
public @interface Optional
null if none is specified.| Modifier and Type | Optional Element and Description |
|---|---|
java.lang.String |
value
The default value to pass to this parameter.
|
public abstract java.lang.String value
The default deserves a bit of explanation. JSR-175 (which defines annotations) says that
Java annotation parameters can only be ConstantExpressions, which can be primitive/string
literals, but not null.
In this case, we use this string as a substitute for null; in practice, TestNG
will pass null to your code, and not the string "null", if you do not specify a
default value here in this parameter.