Package edu.umd.cs.findbugs.ba.jsr305
Class TypeQualifierValue
- java.lang.Object
-
- edu.umd.cs.findbugs.ba.jsr305.TypeQualifierValue
-
public class TypeQualifierValue extends java.lang.Object
A 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.- Author:
- William Pugh
-
-
Field Summary
Fields Modifier and Type Field Description static boolean
DEBUG
ClassDescriptor
typeQualifier
java.lang.Object
value
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description static void
clearInstance()
boolean
equals(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.ClassDescriptor
getTypeQualifierClassDescriptor()
Get the ClassDescriptor which specifies the type qualifier annotation.static TypeQualifierValue
getValue(ClassDescriptor desc, java.lang.Object value)
Given a ClassDescriptor/value pair, return the interned TypeQualifierValue representing that pair.int
hashCode()
static boolean
hasMultipleVariants(TypeQualifierValue tqv)
Determine whether or not given TypeQualifierValue has multiple variants.boolean
isExclusiveQualifier()
Return whether or not this TypeQualifierValue denotes an exclusive qualifier.boolean
isExhaustiveQualifier()
Return whether or not this TypeQualifierValue denotes an exhaustive qualifier.boolean
isStrictQualifier()
Return whether or not this TypeQualifierValue denotes a strict qualifier.java.lang.String
toString()
-
-
-
Field Detail
-
DEBUG
public static final boolean DEBUG
-
typeQualifier
public final ClassDescriptor typeQualifier
-
value
@CheckForNull public final java.lang.Object value
-
-
Method Detail
-
clearInstance
public static void clearInstance()
-
getValue
@NonNull public static TypeQualifierValue getValue(ClassDescriptor desc, 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
-
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:
hashCode
in classjava.lang.Object
-
equals
public boolean equals(java.lang.Object o)
- Overrides:
equals
in classjava.lang.Object
-
toString
public java.lang.String toString()
- Overrides:
toString
in classjava.lang.Object
-
-