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:thisindicates the intrinsic lock of the instance containing the field or method.class-name.thiswhich allows for disambiguation of whichthiswhen dealing with inner classesitselfwhich is valid for reference fields only, and indicates that the referenced instance's own intrinsic lock should be used as the guardfield-nameindicates the named instance or static field is to be used as the guard. If the field type is not a sub-type ofLockthen the intrinsic lock of the referenced instance is to be usedclass-name.field-nameindicates the named static field is to be used as the guard. If the field type is not a sub-type ofLockthen 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 ofLockthen the intrinsic lock of the returned instance is to be usedclass-name.classindicates 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
-