|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||
java.lang.Objectcom.claritysys.jvm.classfile.SigConverter
public class SigConverter
Manages the conversion between Java-friendly type signatures and VM format signatures.
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 Summary | |
|---|---|
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). |
|
| Method Summary | |
|---|---|
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. |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Constructor Detail |
|---|
public SigConverter()
public SigConverter(SigConverter template)
| Method Detail |
|---|
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()
|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||