|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: REQUIRED | OPTIONAL | DETAIL: ELEMENT |
@Documented @Retention(value=RUNTIME) public @interface KeyFor
Indicates that the annotated reference of an Object that is a key in a map.
The value of the annotation should be the reference name of the map. The following declaration for example:
Map<String, String> config = ...;
@KeyFor("config") String key = "HOSTNAME";
String hostname = config.get(key); // known to be non-null
indicates that "HOSTNAME" is a key in config. The Nullness
checker deduce this information to deduce that hostname
reference
is a nonnull reference.
Limitation: The Nullness checker trusts the user and doesn't validate the annotations. Future releases will check for the presence of the key in the map (when possible).
Modifier and Type | Required Element and Description |
---|---|
String[] |
value
One or more Java expressions. |
Element Detail |
---|
public abstract String[] value
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: REQUIRED | OPTIONAL | DETAIL: ELEMENT |