@Documented @Retention(value=RUNTIME) @Target(value={TYPE_USE,TYPE_PARAMETER}) public @interface Dependent
Example:
Consider a field, lock
, that is only initialized if the
enclosing object (the receiver), is marked as ThreadSafe
.
Such a field can be declared as:
private @Nullable @Dependent(result=NonNull.class, when=ThreadSafe.class)
Lock lock;
Modifier and Type | Required Element and Description |
---|---|
Class<? extends Annotation> |
result
The class of the refined qualifier to be applied.
|
Class<? extends Annotation> |
when
The qualifier class of the receiver that causes the
result
qualifier to be applied. |
public abstract Class<? extends Annotation> result
public abstract Class<? extends Annotation> when
result
qualifier to be applied.