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
EquivalenceKey
DeclarationEquivalenceKey
ClassEquivalenceKey
FieldEquivalenceKey
MethodEquivalenceKey
MethodParameterEquivalenceKey
RecordComponentEquivalenceKey
TypeEquivalenceKey
ArrayTypeEquivalenceKey
ClassTypeEquivalenceKey
ParameterizedTypeEquivalenceKey
PrimitiveTypeEquivalenceKey
TypeVariableEquivalenceKey
TypeVariableReferenceEquivalenceKey
UnresolvedTypeVariableEquivalenceKey
VoidTypeEquivalenceKey
WildcardTypeEquivalenceKey
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic final class
static final class
static final class
static class
static final class
static final class
static final class
static final class
static final class
static final class
static class
static final class
static final class
static final class
static final class
static final class
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionstatic EquivalenceKey
of
(AnnotationTarget annotationTarget) Returns an equivalence key for given annotation target.Returns an equivalence key for given class.of
(Declaration declaration) Returns an equivalence key for given declaration.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.private static EquivalenceKey.TypeEquivalenceKey[]
of
(TypeTarget typeTarget) Returns an equivalence key for given type annotation target.private static String
toStringWhereClause
(Set<EquivalenceKey.TypeVariableEquivalenceKey> typeVariables) (package private) String
toStringWithWhere
(Set<EquivalenceKey.TypeVariableEquivalenceKey> typeVariables)
-
Constructor Details
-
EquivalenceKey
private EquivalenceKey()
-
-
Method Details
-
of
Returns an equivalence key for given annotation target.- Parameters:
annotationTarget
- the annotation target, may benull
- Returns:
- equivalence key for given annotation target, only
null
ifannotationTarget == null
-
of
Returns an equivalence key for given declaration.- Parameters:
declaration
- the declaration, may benull
- Returns:
- equivalence key for given declaration, only
null
ifdeclaration == null
- Since:
- 3.1.0
-
of
Returns an equivalence key for given class.- Parameters:
clazz
- the class, may benull
- Returns:
- equivalence key for given class, only
null
ifclazz == null
-
of
Returns an equivalence key for given method.- Parameters:
method
- the method, may benull
- Returns:
- equivalence key for given method, only
null
ifmethod == null
-
of
Returns an equivalence key for given method parameter.- Parameters:
parameter
- the method parameter, may benull
- Returns:
- equivalence key for given method parameter, only
null
ifparameter == null
-
of
Returns an equivalence key for given field.- Parameters:
field
- the field, may benull
- Returns:
- equivalence key for given field, only
null
iffield == null
-
of
Returns an equivalence key for given record component.- Parameters:
recordComponent
- the record component, may benull
- Returns:
- equivalence key for given record component, only
null
ifrecordComponent == 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:
- equivalence key for given type target, only
null
iftypeTarget == null
-
of
Returns an equivalence key for given type.- Parameters:
type
- the type, may benull
- Returns:
- equivalence key for given type, only
null
iftype == null
-
of
-
toStringWithWhere
-
toStringWhereClause
private static String toStringWhereClause(Set<EquivalenceKey.TypeVariableEquivalenceKey> typeVariables)
-