Package org.spongepowered.asm.util
Class SignaturePrinter
java.lang.Object
org.spongepowered.asm.util.SignaturePrinter
public class SignaturePrinter
extends java.lang.Object
Generates callback signature for callback pretty-print
-
Constructor Summary
Constructors Constructor Description SignaturePrinter(java.lang.String name, java.lang.String desc)SignaturePrinter(java.lang.String name, org.objectweb.asm.Type returnType, org.objectweb.asm.tree.LocalVariableNode[] args)SignaturePrinter(java.lang.String name, org.objectweb.asm.Type returnType, org.objectweb.asm.Type[] args)SignaturePrinter(java.lang.String name, org.objectweb.asm.Type returnType, org.objectweb.asm.Type[] argTypes, java.lang.String[] argNames)SignaturePrinter(org.objectweb.asm.tree.MethodNode method)SignaturePrinter(org.objectweb.asm.tree.MethodNode method, java.lang.String[] argNames)SignaturePrinter(org.objectweb.asm.Type[] args)SignaturePrinter(org.objectweb.asm.Type returnType, org.objectweb.asm.Type[] args)SignaturePrinter(ITargetSelectorByName member) -
Method Summary
Modifier and Type Method Description java.lang.StringgetFormattedArgs()Return only the arguments portion of this signature as a Java-style blockjava.lang.StringgetReturnType()Get string representation of this signature's return typestatic java.lang.StringgetTypeName(org.objectweb.asm.Type type)Get the source code name for the specified typestatic java.lang.StringgetTypeName(org.objectweb.asm.Type type, boolean box)Get the source code name for the specified typestatic java.lang.StringgetTypeName(org.objectweb.asm.Type type, boolean box, boolean fullyQualified)Get the source code name for the specified typebooleanisFullyQualified()Get whether this printer will fully-qualify class names in generated signaturesSignaturePrintersetFullyQualified(boolean fullyQualified)Set whether this signature generates fully-qualified class output, mainly used when generating signatures for MirrorSignaturePrintersetModifiers(java.lang.String modifiers)Set modifiers on this signature explicitly.voidsetModifiers(org.objectweb.asm.tree.MethodNode method)Set modifiers on this signature using the supplied method nodejava.lang.StringtoDescriptor()Return this signature in descriptor format (return type after args)java.lang.StringtoString()Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
-
Constructor Details
-
SignaturePrinter
public SignaturePrinter(org.objectweb.asm.tree.MethodNode method) -
SignaturePrinter
public SignaturePrinter(org.objectweb.asm.tree.MethodNode method, java.lang.String[] argNames) -
SignaturePrinter
-
SignaturePrinter
public SignaturePrinter(java.lang.String name, java.lang.String desc) -
SignaturePrinter
public SignaturePrinter(org.objectweb.asm.Type[] args) -
SignaturePrinter
public SignaturePrinter(org.objectweb.asm.Type returnType, org.objectweb.asm.Type[] args) -
SignaturePrinter
public SignaturePrinter(java.lang.String name, org.objectweb.asm.Type returnType, org.objectweb.asm.Type[] args) -
SignaturePrinter
public SignaturePrinter(java.lang.String name, org.objectweb.asm.Type returnType, org.objectweb.asm.tree.LocalVariableNode[] args) -
SignaturePrinter
public SignaturePrinter(java.lang.String name, org.objectweb.asm.Type returnType, org.objectweb.asm.Type[] argTypes, java.lang.String[] argNames)
-
-
Method Details
-
getFormattedArgs
public java.lang.String getFormattedArgs()Return only the arguments portion of this signature as a Java-style block -
getReturnType
public java.lang.String getReturnType()Get string representation of this signature's return type -
setModifiers
public void setModifiers(org.objectweb.asm.tree.MethodNode method)Set modifiers on this signature using the supplied method node- Parameters:
method- method node to read modifiers from
-
setModifiers
Set modifiers on this signature explicitly. Use the special token ${returnType} to insert the return type into the modifier string.- Parameters:
modifiers- modifiers to prepend- Returns:
- fluent interface
-
setFullyQualified
Set whether this signature generates fully-qualified class output, mainly used when generating signatures for Mirror- Parameters:
fullyQualified- new value for fully-qualified- Returns:
- fluent interface
-
isFullyQualified
public boolean isFullyQualified()Get whether this printer will fully-qualify class names in generated signatures -
toString
public java.lang.String toString()- Overrides:
toStringin classjava.lang.Object
-
toDescriptor
public java.lang.String toDescriptor()Return this signature in descriptor format (return type after args) -
getTypeName
public static java.lang.String getTypeName(org.objectweb.asm.Type type)Get the source code name for the specified type- Parameters:
type- Type to generate a friendly name for- Returns:
- String representation of the specified type, eg "int" for an integer primitive or "String" for java.lang.String
-
getTypeName
public static java.lang.String getTypeName(org.objectweb.asm.Type type, boolean box)Get the source code name for the specified type- Parameters:
type- Type to generate a friendly name forbox- True to return the equivalent boxing type for primitives- Returns:
- String representation of the specified type, eg "int" for an integer primitive or "String" for java.lang.String
-
getTypeName
public static java.lang.String getTypeName(org.objectweb.asm.Type type, boolean box, boolean fullyQualified)Get the source code name for the specified type- Parameters:
type- Type to generate a friendly name forbox- True to return the equivalent boxing type for primitivesfullyQualified- fully-qualify class names- Returns:
- String representation of the specified type, eg "int" for an integer primitive or "String" for java.lang.String
-