Package proguard.classfile
Class Signature
- java.lang.Object
-
- proguard.classfile.Signature
-
- All Implemented Interfaces:
java.lang.Comparable<Signature>
- Direct Known Subclasses:
ClassSignature
,FieldSignature
,MethodSignature
public abstract class Signature extends java.lang.Object implements java.lang.Comparable<Signature>
A signature currently can be a Method- or a FieldSignature. This class can be used to create the correct one from a ProguardCORE member object (which can also be a method or a field).
-
-
Constructor Summary
Constructors Modifier Constructor Description protected
Signature(java.lang.String internalClassName, int hashCode)
-
Method Summary
All Methods Static Methods Instance Methods Abstract Methods Concrete Methods Deprecated Methods Modifier and Type Method Description protected abstract java.lang.String
calculateFqn()
protected abstract java.lang.String
calculatePrettyFqn()
static void
clearCache()
Clear the signature caches of allSignature
subclasses.int
compareTo(Signature o)
static Signature
computeIfAbsent(Clazz clazz, Member member)
This factory uses the caching features provided byMethodSignature.computeIfAbsent(Clazz, Method)
,FieldSignature.computeIfAbsent(Clazz, Field)
andClassSignature.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()
@Nullable Clazz
getReferencedClass()
Returns theClazz
reference corresponding to the class returned bygetClassName()
ornull
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 anyMember
and generates the appropriate signature, i.e.static void
setCacheEnabled(boolean cacheEnabled)
Enable or disable automatic caching inof(Clazz, Member)
.java.lang.String
toString()
-
-
-
Field Detail
-
fqn
protected java.lang.String fqn
-
prettyFqn
protected java.lang.String prettyFqn
-
className
protected final java.lang.String className
-
hashCode
protected final int hashCode
-
referencedClass
@Nullable protected @Nullable Clazz referencedClass
-
-
Method Detail
-
isIncomplete
public abstract boolean isIncomplete()
Check if this signature is missing information.
-
of
public static Signature of(Clazz clazz, Member member)
Convenience factory that takes anyMember
and generates the appropriate signature, i.e.MethodSignature
s forMethod
s andFieldSignature
s forField
s. If the member is null, aClassSignature
is generated.Note that if
cacheEnabled
is set to true, the generation process is delegated tocomputeIfAbsent(Clazz, Member)
to make use of caching features.- Parameters:
clazz
- The class containing the membermember
- The target member- Returns:
- The corresponding
Signature
object
-
computeIfAbsent
public static Signature computeIfAbsent(Clazz clazz, Member member)
This factory uses the caching features provided byMethodSignature.computeIfAbsent(Clazz, Method)
,FieldSignature.computeIfAbsent(Clazz, Field)
andClassSignature.computeIfAbsent(Clazz)
. Only one signature is created for each distinctMethod
,Field
orClazz
. If the same signature is requested several times, the previously created object will be returned.- Parameters:
clazz
- The class containing the membermember
- The target member- Returns:
- The corresponding
Signature
object
-
clearCache
public static void clearCache()
Clear the signature caches of allSignature
subclasses.
-
setCacheEnabled
public static void setCacheEnabled(boolean cacheEnabled)
Enable or disable automatic caching inof(Clazz, Member)
. Existing caches are purged once caching has been disabled.
-
getFqn
public java.lang.String getFqn()
-
getPrettyFqn
public java.lang.String getPrettyFqn()
-
getPackageName
@Deprecated public java.lang.String getPackageName()
Deprecated.
-
getExternalPackageName
public java.lang.String getExternalPackageName()
- Returns:
- the external package name (e.g., `java.lang` for `java.lang.Object`)
-
getClassName
public java.lang.String getClassName()
-
calculateFqn
protected abstract java.lang.String calculateFqn()
-
calculatePrettyFqn
protected abstract java.lang.String calculatePrettyFqn()
-
getReferencedClass
@Nullable public @Nullable Clazz getReferencedClass()
Returns theClazz
reference corresponding to the class returned bygetClassName()
ornull
if no reference is available (e.g. class is missing from the class pool).
-
equals
public boolean equals(java.lang.Object o)
- Overrides:
equals
in classjava.lang.Object
-
hashCode
public int hashCode()
- Overrides:
hashCode
in classjava.lang.Object
-
compareTo
public int compareTo(Signature o)
- Specified by:
compareTo
in interfacejava.lang.Comparable<Signature>
-
toString
public java.lang.String toString()
- Overrides:
toString
in classjava.lang.Object
-
-