Package org.spongepowered.asm.util
Class ClassSignature
java.lang.Object
org.spongepowered.asm.util.ClassSignature
Represents an object-oriented view of a generic class signature. We use ASM's
SignatureVisitor to walk over an incoming signature in order to parse
out our internal tree. This is done so that incoming signatures from mixins
can be merged into the target class.-
Field Summary
Fields -
Method Summary
Modifier and TypeMethodDescriptionvoidaddInterface(String iface) Add a raw interface declaration to this signatureprotected voidaddInterface(org.spongepowered.asm.util.ClassSignature.Token iface) Add an interface to this signatureprotected voidaddRawInterface(String iface) Add a raw interface which was previously enqueuedprotected voidaddTypeVar(org.spongepowered.asm.util.ClassSignature.TypeVar typeVar, org.spongepowered.asm.util.ClassSignature.TokenHandle handle) Add a type var to this signature, the type var must not existorg.objectweb.asm.signature.SignatureVisitorGet a remapper for type vars in this signatureGet the raw superclass type of this signature as a stringprotected org.spongepowered.asm.util.ClassSignature.TokenHandleGet the token for the specified type var name, creating it if necessaryprotected org.spongepowered.asm.util.ClassSignature.TypeVargetTypeVar(String varName) Get the type var for the specified var nameprotected StringgetTypeVar(org.spongepowered.asm.util.ClassSignature.TokenHandle handle) Get the type var matching the supplied type token, or the raw token type if no mapping exists for the supplied token handlevoidmerge(ClassSignature other) Merges another class signature into this one.static ClassSignatureParse a generic class signature from the supplied stringstatic ClassSignatureof(org.objectweb.asm.tree.ClassNode classNode) Parse a generic class signature from the supplied class node, uses the declared signature if present, else falls back to generating a raw signature from the class itselfstatic ClassSignatureofLazy(org.objectweb.asm.tree.ClassNode classNode) Returns a lazy-evaluated signature object.protected voidsetSuperClass(org.spongepowered.asm.util.ClassSignature.Token superClass) Set the superclass for this signaturetoString()Converts this signature into a string representation compatible with the signature attribute of a Java classwake()Wake up this signature if it is lazy-loaded
-
Field Details
-
OBJECT
- See Also:
-
-
Method Details
-
getTypeVar
Get the type var for the specified var name- Parameters:
varName- type var to lookup- Returns:
- type var for the supplied type var name
-
getType
Get the token for the specified type var name, creating it if necessary- Parameters:
varName- type var to lookup- Returns:
- type token for the supplied type var name
-
getTypeVar
Get the type var matching the supplied type token, or the raw token type if no mapping exists for the supplied token handle- Parameters:
handle- type token handle to lookup- Returns:
- type var (with prefix and suffix) or raw type name
-
addTypeVar
protected void addTypeVar(org.spongepowered.asm.util.ClassSignature.TypeVar typeVar, org.spongepowered.asm.util.ClassSignature.TokenHandle handle) throws IllegalArgumentException Add a type var to this signature, the type var must not exist- Parameters:
typeVar- type var to addhandle- type var's type token- Throws:
IllegalArgumentException- if the specified type var already exists
-
setSuperClass
protected void setSuperClass(org.spongepowered.asm.util.ClassSignature.Token superClass) Set the superclass for this signature- Parameters:
superClass- super class to set
-
getSuperClass
Get the raw superclass type of this signature as a string- Returns:
- superclass type as a string
-
addInterface
protected void addInterface(org.spongepowered.asm.util.ClassSignature.Token iface) Add an interface to this signature- Parameters:
iface- interface to add
-
addInterface
Add a raw interface declaration to this signature- Parameters:
iface- interface name to add (bin format)
-
addRawInterface
Add a raw interface which was previously enqueued- Parameters:
iface- interface to add
-
merge
Merges another class signature into this one. The other signature is first conformed so that no formal type parameters overlap with formal type parameters defined on this signature. No attempt is made to combine formal type parameters, this method merely ensures that parameters do not overlap.- Parameters:
other- Class signature to merge into this one
-
getRemapper
public org.objectweb.asm.signature.SignatureVisitor getRemapper()Get a remapper for type vars in this signature- Returns:
- signature visitor
-
toString
Converts this signature into a string representation compatible with the signature attribute of a Java class -
wake
Wake up this signature if it is lazy-loaded -
of
Parse a generic class signature from the supplied string- Parameters:
signature- signature string to parse- Returns:
- parsed signature object
-
of
Parse a generic class signature from the supplied class node, uses the declared signature if present, else falls back to generating a raw signature from the class itself- Parameters:
classNode- class node to parse- Returns:
- parsed signature
-
ofLazy
Returns a lazy-evaluated signature object. For classes with a signature present this saves having to do the parse until we actually need it. For classes with no signature we just go ahead and generate it from the supplied ClassNode while we have it- Parameters:
classNode- class node to parse- Returns:
- parsed signature or lazy-load handle
-