Interface SymbolicValue.SymAnnot
-
- All Superinterfaces:
SymbolicValue
- Enclosing interface:
- SymbolicValue
public static interface SymbolicValue.SymAnnot extends SymbolicValue
Symbolic representation of an annotation.
-
-
Nested Class Summary
-
Nested classes/interfaces inherited from interface net.sourceforge.pmd.lang.java.symbols.SymbolicValue
SymbolicValue.SymAnnot, SymbolicValue.SymArray, SymbolicValue.SymClass, SymbolicValue.SymEnum, SymbolicValue.SymValue
-
-
Method Summary
All Methods Instance Methods Abstract Methods Default Methods Modifier and Type Method Description default OptionalBool
attributeContains(String attrName, Object attrValue)
Returns YES if the annotation has the attribute set to the given value, or to an array containing the given value.default OptionalBool
attributeMatches(String attrName, Object attrValue)
Returns YES if the annotation has the attribute set to the given value.@NonNull JClassSymbol
getAnnotationSymbol()
Return the symbol for the declaring class of the annotation.@Nullable SymbolicValue
getAttribute(String attrName)
Returns the value of the attribute, which may fall back to the default value of the annotation element.default org.pcollections.PSet<String>
getAttributeNames()
Return the simple names of all attributes, including those defined in the annotation type but not explicitly set in this annotation.default String
getBinaryName()
Return the binary name of the annotation type.default RetentionPolicy
getRetention()
The retention policy.default String
getSimpleName()
Return the simple name of the annotation type.default boolean
isOfType(Class<? extends Annotation> klass)
Whether the annotation has the given type.default boolean
isOfType(String binaryName)
Return true if this annotation's binary name matches the given binary name.default boolean
valueEquals(Object o)
Returns true if this symbolic value represents the same value as the given object.-
Methods inherited from interface net.sourceforge.pmd.lang.java.symbols.SymbolicValue
equals
-
-
-
-
Method Detail
-
getAttribute
@Nullable SymbolicValue getAttribute(String attrName)
Returns the value of the attribute, which may fall back to the default value of the annotation element. Returns null if the attribute does not exist, is unresolved, or has no default. TODO do we need separate sentinels for that?
-
getAnnotationSymbol
@NonNull JClassSymbol getAnnotationSymbol()
Return the symbol for the declaring class of the annotation.
-
getAttributeNames
default org.pcollections.PSet<String> getAttributeNames()
Return the simple names of all attributes, including those defined in the annotation type but not explicitly set in this annotation. Note that if the annotation is reflected from a class file, we can't know which annotations used their default value, so it returns a set of all attribute names.
-
getBinaryName
default String getBinaryName()
Return the binary name of the annotation type.
-
getSimpleName
default String getSimpleName()
Return the simple name of the annotation type.
-
valueEquals
default boolean valueEquals(Object o)
Description copied from interface:SymbolicValue
Returns true if this symbolic value represents the same value as the given object. If the parameter is null, returns false.- Specified by:
valueEquals
in interfaceSymbolicValue
-
getRetention
default RetentionPolicy getRetention()
The retention policy. Note that naturally, members accessed from class files cannot reflect annotations withRetentionPolicy.SOURCE
.
-
isOfType
default boolean isOfType(String binaryName)
Return true if this annotation's binary name matches the given binary name.
-
isOfType
default boolean isOfType(Class<? extends Annotation> klass)
Whether the annotation has the given type. Note that only the name of the class is taken into account, because itsClass
instance may be missing from the type system classpath.
-
attributeMatches
default OptionalBool attributeMatches(String attrName, Object attrValue)
Returns YES if the annotation has the attribute set to the given value. Returns NO if it is set to another value. Returns UNKNOWN if the attribute does not exist or is unresolved.
-
attributeContains
default OptionalBool attributeContains(String attrName, Object attrValue)
Returns YES if the annotation has the attribute set to the given value, or to an array containing the given value. Returns NO if that's not the case. Returns UNKNOWN if the attribute does not exist or is unresolved.
-
-