Package org.jboss.jandex
Class EquivalenceKey
java.lang.Object
org.jboss.jandex.EquivalenceKey
- Direct Known Subclasses:
EquivalenceKey.DeclarationEquivalenceKey,EquivalenceKey.TypeEquivalenceKey
Establishes a notion of equivalence of Jandex objects. Two Jandex objects are equivalent if and only if
they denote the same Java declaration or type, without taking into account any annotations. The prime use case
is to assist with building annotation overlays on top of Jandex, where it is common to have multiple Jandex
objects with different annotations, but otherwise equivalent.
In contrast, the common Jandex classes such as ClassInfo, MethodInfo or FieldInfo
either don't provide equality at all (and hence can only be compared by identity) or provide strict equality,
which includes presence or absence of annotations and comparison of their members, as well as other details.
An instance of this class, also called an equivalence key, provides 3 fundamental operations, corresponding to the 3 common methods all Java classes have:
equals(): when two Jandex objects are equivalent, their equivalence keys are equalhashCode(): consistent withequals()described abovetoString(): human readable representation of the equivalence key; format of the value is not guaranteed and may change without notice
EquivalenceKeyDeclarationEquivalenceKeyClassEquivalenceKeyMethodEquivalenceKeyMethodParameterEquivalenceKeyFieldEquivalenceKeyRecordComponentEquivalenceKey
TypeEquivalenceKeyArrayTypeEquivalenceKeyClassTypeEquivalenceKeyParameterizedTypeEquivalenceKeyPrimitiveTypeEquivalenceKeyTypeVariableEquivalenceKeyTypeVariableReferenceEquivalenceKeyUnresolvedTypeVariableEquivalenceKeyVoidTypeEquivalenceKeyWildcardTypeEquivalenceKey
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic final classstatic final classstatic final classstatic classstatic final classstatic final classstatic final classstatic final classstatic final classstatic final classstatic classstatic final classstatic final classstatic final classstatic final classstatic final class -
Method Summary
Modifier and TypeMethodDescriptionstatic EquivalenceKeyof(AnnotationTarget annotationTarget) Returns an equivalence key for givenannotation target.Returns an equivalence key for given class.of(Declaration declaration) Returns an equivalence key for givendeclaration.Returns an equivalence key for given field.of(MethodInfo method) Returns an equivalence key for given method.of(MethodParameterInfo parameter) Returns an equivalence key for given method parameter.of(RecordComponentInfo recordComponent) Returns an equivalence key for given record component.Returns an equivalence key for given type.of(TypeTarget typeTarget) Returns an equivalence key for given type annotation target.
-
Method Details
-
of
Returns an equivalence key for givenannotation target.- Parameters:
annotationTarget- the annotation target, may benull- Returns:
- equvalence key for given annotation target, only
nullifannotationTarget == null
-
of
Returns an equivalence key for givendeclaration.- Parameters:
declaration- the declaration, may benull- Returns:
- equvalence key for given declaration, only
nullifdeclaration == null - Since:
- 3.1.0
-
of
Returns an equivalence key for given class.- Parameters:
clazz- the class, may benull- Returns:
- equvalence key for given class, only
nullifclazz == null
-
of
Returns an equivalence key for given method.- Parameters:
method- the method, may benull- Returns:
- equvalence key for given method, only
nullifmethod == null
-
of
Returns an equivalence key for given method parameter.- Parameters:
parameter- the method parameter, may benull- Returns:
- equvalence key for given method parameter, only
nullifparameter == null
-
of
Returns an equivalence key for given field.- Parameters:
field- the field, may benull- Returns:
- equvalence key for given field, only
nulliffield == null
-
of
Returns an equivalence key for given record component.- Parameters:
recordComponent- the record component, may benull- Returns:
- equvalence key for given record component, only
nullifrecordComponent == null
-
of
Returns an equivalence key for given type annotation target. It is the equivalence key of the annotated type.- Parameters:
typeTarget- the type target, may benull- Returns:
- equvalence key for given type target, only
nulliftypeTarget == null
-
of
Returns an equivalence key for given type.- Parameters:
type- the type, may benull- Returns:
- equvalence key for given type, only
nulliftype == null
-