public class SigConverter
extends java.lang.Object
Eg, the Java-friendly signature
"@Class.forName(String)Class"will be converted to the VM format:
"java/lang/Class.forName (Ljava/lang/String;)Ljava/lang/Class;".
This is an optional feature of the JVM package which really simplifies generating classes, at a small performance cost.
Constructor and Description |
---|
SigConverter()
Create a new SigConverter with only the primitive types initially.
|
SigConverter(SigConverter template)
Create a SigConverter with all the mappings from the given one
(eg, create a clone).
|
Modifier and Type | Method and Description |
---|---|
java.lang.String |
addImport(java.lang.String cls)
Import the given class, returning its short name.
|
void |
dumpAliases()
Dump imports to System.out.
|
java.lang.String[] |
getArgTypes(java.lang.String sig)
Parse the arg types of the method signature.
|
java.lang.String |
getFullName(java.lang.String cls)
Return the full name for the given short name.
|
java.lang.String |
getReturnType(java.lang.String sig)
Parse the return type of the method signature.
|
java.lang.String |
getType(java.lang.String javaType)
Return the VM type for the given Java-friendly type.
|
java.lang.String |
toVmMethodSig(java.lang.String jlSig)
Convert the given Java Language formed signature into a VM-style
signature.
|
static java.lang.String |
toVmSig(java.lang.String rtype,
java.lang.String[] ptypes)
Convert type and param types to method signature in VM format.
|
public SigConverter()
public SigConverter(SigConverter template)
public java.lang.String addImport(java.lang.String cls)
cls
- The fully qualified name of the class in either VM or JLS
format (eg, "java/lang/String" or "java.lang.String").public java.lang.String getFullName(java.lang.String cls)
public java.lang.String toVmMethodSig(java.lang.String jlSig)
Eg, "(int[],boolean,String)boolean" --> "([IZLjava/lang/String;)Z"
public static java.lang.String toVmSig(java.lang.String rtype, java.lang.String[] ptypes)
public java.lang.String getType(java.lang.String javaType)
Parses random JL-formed declarations:
int, boolean, Object, com.foo.Bar, int[], etc.
public java.lang.String getReturnType(java.lang.String sig)
public java.lang.String[] getArgTypes(java.lang.String sig)
public void dumpAliases()
Copyright ? 2000-2003 Clarity Systems Group, LLC. All Rights Reserved.