Package javax.annotation.concurrent
Annotation Interface GuardedBy
The presence of this annotation indicates that the field or method must only be accessed when holding the specified
lock.
-
Required Element Summary
Required Elements
-
Element Details
-
value
String valueThe specified lock that guards the annotated field or method. Valid values are:this
indicates the intrinsic lock of the instance containing the field or method.class-name.this
which allows for disambiguation of whichthis
when dealing with inner classesitself
which is valid for reference fields only, and indicates that the referenced instance's own intrinsic lock should be used as the guardfield-name
indicates the named instance or static field is to be used as the guard. If the field type is not a sub-type ofLock
then the intrinsic lock of the referenced instance is to be usedclass-name.field-name
indicates the named static field is to be used as the guard. If the field type is not a sub-type ofLock
then the intrinsic lock of the referenced instance is to be usedmethod-name()
indicates that the zero-argument method should be called to obtain the lock object. If the return type is not a sub-type ofLock
then the intrinsic lock of the returned instance is to be usedclass-name.class
indicates that the intrinsic lock of the specified class should be used as the guard
- Returns:
- The specified lock that guards the annotated field or method
-