Package edu.umd.cs.findbugs.ba.jsr305
Class TypeQualifierValue<A extends java.lang.annotation.Annotation>
- java.lang.Object
-
- edu.umd.cs.findbugs.ba.jsr305.TypeQualifierValue<A>
-
public class TypeQualifierValue<A extends java.lang.annotation.Annotation> extends java.lang.ObjectA TypeQualifierValue is a pair specifying a type qualifier annotation and a value. Each TypeQualifierValue is effectively a different type qualifier. For example, if Foo is a type qualifier annotation having an int value, then Foo(0), Foo(1), etc. are all different type qualifiers which must be checked separately.
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description (package private) static classTypeQualifierValue.Data
-
Field Summary
Fields Modifier and Type Field Description static booleanDEBUGstatic booleanDEBUG_CLASSLOADINGprivate static ClassDescriptorEXCLUSIVE_ANNOTATIONprivate static ClassDescriptorEXHAUSTIVE_ANNOTATIONprivate static java.lang.ThreadLocal<TypeQualifierValue.Data>instanceprivate booleanisExclusiveprivate booleanisExhaustiveprivate booleanisStrictAproxyClassDescriptortypeQualifierjava.lang.Class<A>typeQualifierClassprivate javax.annotation.meta.TypeQualifierValidator<A>validatorjava.lang.Objectvalue
-
Constructor Summary
Constructors Modifier Constructor Description privateTypeQualifierValue(ClassDescriptor typeQualifier, java.lang.Object value)
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description booleancanValidate(java.lang.Object constantValue)static voidclearInstance()booleanequals(java.lang.Object o)static java.util.Collection<TypeQualifierValue<?>>getAllKnownTypeQualifiers()Get Collection of all known TypeQualifierValues.static java.util.Collection<TypeQualifierValue<?>>getComplementaryExclusiveTypeQualifierValue(TypeQualifierValue<?> tqv)Get the "complementary" TypeQualifierValues for given exclusive type qualifier.private static <A> java.lang.Class<A>getQualifierClass(ClassDescriptor typeQualifier)ClassDescriptorgetTypeQualifierClassDescriptor()Get the ClassDescriptor which specifies the type qualifier annotation.private static <A extends java.lang.annotation.Annotation>
javax.annotation.meta.TypeQualifierValidator<A>getValidator(java.lang.Class<? extends javax.annotation.meta.TypeQualifierValidator<A>> checkerClass)static TypeQualifierValue<?>getValue(ClassDescriptor desc, java.lang.Object value)Given a ClassDescriptor/value pair, return the interned TypeQualifierValue representing that pair.static <A extends java.lang.annotation.Annotation>
TypeQualifierValue<A>getValue(java.lang.Class<A> clazz, java.lang.Object value)inthashCode()static booleanhasMultipleVariants(TypeQualifierValue<?> tqv)Determine whether or not given TypeQualifierValue has multiple variants.booleanisExclusiveQualifier()Return whether or not this TypeQualifierValue denotes an exclusive qualifier.booleanisExhaustiveQualifier()Return whether or not this TypeQualifierValue denotes an exhaustive qualifier.booleanisStrictQualifier()Return whether or not this TypeQualifierValue denotes a strict qualifier.(package private) static byte[]loadClassData(java.lang.String name)java.lang.StringtoString()javax.annotation.meta.Whenvalidate(java.lang.Object constantValue)
-
-
-
Field Detail
-
DEBUG
public static final boolean DEBUG
-
DEBUG_CLASSLOADING
public static final boolean DEBUG_CLASSLOADING
-
EXCLUSIVE_ANNOTATION
private static final ClassDescriptor EXCLUSIVE_ANNOTATION
-
EXHAUSTIVE_ANNOTATION
private static final ClassDescriptor EXHAUSTIVE_ANNOTATION
-
typeQualifier
public final ClassDescriptor typeQualifier
-
typeQualifierClass
public final java.lang.Class<A extends java.lang.annotation.Annotation> typeQualifierClass
-
proxy
public final A extends java.lang.annotation.Annotation proxy
-
value
@CheckForNull public final java.lang.Object value
-
isStrict
private final boolean isStrict
-
isExclusive
private final boolean isExclusive
-
isExhaustive
private final boolean isExhaustive
-
validator
@CheckForNull private final javax.annotation.meta.TypeQualifierValidator<A extends java.lang.annotation.Annotation> validator
-
instance
private static java.lang.ThreadLocal<TypeQualifierValue.Data> instance
-
-
Constructor Detail
-
TypeQualifierValue
private TypeQualifierValue(ClassDescriptor typeQualifier, @CheckForNull java.lang.Object value)
-
-
Method Detail
-
getValidator
private static <A extends java.lang.annotation.Annotation> javax.annotation.meta.TypeQualifierValidator<A> getValidator(java.lang.Class<? extends javax.annotation.meta.TypeQualifierValidator<A>> checkerClass) throws java.lang.InstantiationException, java.lang.IllegalAccessException- Throws:
java.lang.InstantiationExceptionjava.lang.IllegalAccessException
-
getQualifierClass
private static <A> java.lang.Class<A> getQualifierClass(ClassDescriptor typeQualifier) throws java.lang.ClassNotFoundException
- Throws:
java.lang.ClassNotFoundException
-
loadClassData
static byte[] loadClassData(java.lang.String name) throws CheckedAnalysisException- Throws:
CheckedAnalysisException
-
clearInstance
public static void clearInstance()
-
canValidate
public boolean canValidate(@CheckForNull java.lang.Object constantValue)
-
validate
public javax.annotation.meta.When validate(@CheckForNull java.lang.Object constantValue)
-
getValue
@Nonnull public static TypeQualifierValue<?> getValue(ClassDescriptor desc, @CheckForNull java.lang.Object value)
Given a ClassDescriptor/value pair, return the interned TypeQualifierValue representing that pair.- Parameters:
desc- a ClassDescriptor denoting a type qualifier annotationvalue- a value- Returns:
- an interned TypeQualifierValue object
-
getValue
@Nonnull public static <A extends java.lang.annotation.Annotation> TypeQualifierValue<A> getValue(java.lang.Class<A> clazz, @CheckForNull java.lang.Object value)
-
getAllKnownTypeQualifiers
public static java.util.Collection<TypeQualifierValue<?>> getAllKnownTypeQualifiers()
Get Collection of all known TypeQualifierValues.- Returns:
- Collection of all known TypeQualifierValues
-
getComplementaryExclusiveTypeQualifierValue
public static java.util.Collection<TypeQualifierValue<?>> getComplementaryExclusiveTypeQualifierValue(TypeQualifierValue<?> tqv)
Get the "complementary" TypeQualifierValues for given exclusive type qualifier.- Parameters:
tqv- a type qualifier (which must be exclusive)- Returns:
- Collection of complementary exclusive type qualifiers
-
hasMultipleVariants
public static boolean hasMultipleVariants(TypeQualifierValue<?> tqv)
Determine whether or not given TypeQualifierValue has multiple variants. I.e., if Color is a type qualifier having values RED, GREEN, and BLUE, then there are 3 variants, Color(RED), Color(GREEN), and COLOR(BLUE).- Parameters:
tqv- a TypeQualifierValue- Returns:
- true if there are multiple variants of this type qualifier, false otherwise
-
getTypeQualifierClassDescriptor
public ClassDescriptor getTypeQualifierClassDescriptor()
Get the ClassDescriptor which specifies the type qualifier annotation.- Returns:
- ClassDescriptor which specifies the type qualifier annotation
-
isStrictQualifier
public boolean isStrictQualifier()
Return whether or not this TypeQualifierValue denotes a strict qualifier.- Returns:
- true if type qualifier is strict, false otherwise
-
isExclusiveQualifier
public boolean isExclusiveQualifier()
Return whether or not this TypeQualifierValue denotes an exclusive qualifier.- Returns:
- true if type qualifier is exclusive, false otherwise
-
isExhaustiveQualifier
public boolean isExhaustiveQualifier()
Return whether or not this TypeQualifierValue denotes an exhaustive qualifier.- Returns:
- true if type qualifier is exhaustive, false otherwise
-
hashCode
public int hashCode()
- Overrides:
hashCodein classjava.lang.Object
-
equals
public boolean equals(java.lang.Object o)
- Overrides:
equalsin classjava.lang.Object
-
toString
public java.lang.String toString()
- Overrides:
toStringin classjava.lang.Object
-
-