public abstract class Signature extends java.lang.Object implements java.lang.Comparable<Signature>
Modifier and Type | Field and Description |
---|---|
protected java.lang.String |
className |
protected java.lang.String |
fqn |
protected int |
hashCode |
protected java.lang.String |
prettyFqn |
protected Clazz |
referencedClass
|
Modifier | Constructor and Description |
---|---|
protected |
Signature(java.lang.String internalClassName,
int hashCode) |
Modifier and Type | Method and Description |
---|---|
protected abstract java.lang.String |
calculateFqn() |
protected abstract java.lang.String |
calculatePrettyFqn() |
static void |
clearCache()
Clear the signature caches of all
Signature subclasses. |
int |
compareTo(Signature o) |
static Signature |
computeIfAbsent(Clazz clazz,
Member member)
This factory uses the caching features provided
by
MethodSignature.computeIfAbsent(Clazz, Method) ,
FieldSignature.computeIfAbsent(Clazz, Field)
and ClassSignature.computeIfAbsent(Clazz) . |
boolean |
equals(java.lang.Object o) |
java.lang.String |
getClassName() |
java.lang.String |
getExternalPackageName() |
java.lang.String |
getFqn() |
java.lang.String |
getPackageName()
Deprecated.
|
java.lang.String |
getPrettyFqn() |
Clazz |
getReferencedClass()
Returns the
Clazz reference corresponding
to the class returned by getClassName()
or null if no reference is available (e.g. |
int |
hashCode() |
abstract boolean |
isIncomplete()
Check if this signature is missing information.
|
static Signature |
of(Clazz clazz,
Member member)
Convenience factory that takes any
Member and generates the
appropriate signature, i.e. |
static void |
setCacheEnabled(boolean cacheEnabled)
Enable or disable automatic caching in
of(Clazz, Member) . |
java.lang.String |
toString() |
protected java.lang.String fqn
protected java.lang.String prettyFqn
protected final java.lang.String className
protected final int hashCode
protected Clazz referencedClass
public abstract boolean isIncomplete()
public static Signature of(Clazz clazz, Member member)
Member
and generates the
appropriate signature, i.e. MethodSignature
s for Method
s
and FieldSignature
s for Field
s. If the member is null,
a ClassSignature
is generated.
Note that if cacheEnabled
is set to true,
the generation process is delegated to computeIfAbsent(Clazz, Member)
to make use of caching features.
clazz
- The class containing the membermember
- The target memberSignature
objectpublic static Signature computeIfAbsent(Clazz clazz, Member member)
MethodSignature.computeIfAbsent(Clazz, Method)
,
FieldSignature.computeIfAbsent(Clazz, Field)
and ClassSignature.computeIfAbsent(Clazz)
.
Only one signature is created for each distinct Method
,
Field
or Clazz
. If the same signature is requested
several times, the previously created object will be returned.clazz
- The class containing the membermember
- The target memberSignature
objectpublic static void clearCache()
Signature
subclasses.public static void setCacheEnabled(boolean cacheEnabled)
of(Clazz, Member)
.
Existing caches are purged once caching has been disabled.public java.lang.String getFqn()
public java.lang.String getPrettyFqn()
@Deprecated public java.lang.String getPackageName()
public java.lang.String getExternalPackageName()
public java.lang.String getClassName()
protected abstract java.lang.String calculateFqn()
protected abstract java.lang.String calculatePrettyFqn()
public Clazz getReferencedClass()
Clazz
reference corresponding
to the class returned by getClassName()
or null
if no reference is available (e.g. class is missing from the class pool).public boolean equals(java.lang.Object o)
equals
in class java.lang.Object
public int hashCode()
hashCode
in class java.lang.Object
public int compareTo(Signature o)
compareTo
in interface java.lang.Comparable<Signature>
public java.lang.String toString()
toString
in class java.lang.Object