Top Description Inners Fields Constructors Methods
me.qmx.jitescript

public Class JiteClass

extends Object
implements Opcodes
Class Inheritance
All Implemented Interfaces
org.objectweb.asm.Opcodes
Static Imports
me.qmx.jitescript.CodeBlock.newCodeBlock, me.qmx.jitescript.util.CodegenUtils.p, .CodegenUtils.sig

Represents a Java Class
Author
qmx

Nested and Inner Type Summary

Modifier and TypeClass and Description
private static class

Field Summary

Modifier and TypeField and Description
private int
private final List<VisibleAnnotation>
private final List<JiteClass.ChildEntry>
private final String
private final List<FieldDefinition>
public static final String[]
private final List<String>
private final List<MethodDefinition>
private String
private String
private String
private final String

Constructor Summary

AccessConstructor and Description
public
JiteClass(String
the desired class name
className
)

Creates a new class representation

public
JiteClass(String
the desired class name
className
,
String[]
the desired java interfaces this class will implement
interfaces
)

Creates a new class representation

public
JiteClass(String
the desired class name
className
,
String
the desired parent class
superClassName
,
String[]
the desired java interfaces this class will implement
interfaces
)

Creates a new class representation

Method Summary

Modifier and TypeMethod and Description
public void
public void
public void
addChildClass(String innerName, JiteClass child)

public void
defineDefaultConstructor()

Defines a default constructor on the target class

public void
public FieldDefinition

Returns:

the new field definition for further modification
defineField
(String
the field name
fieldName
,
int
the modifier bitmask, made by OR'ing constants from ASM's Opcodes interface
modifiers
,
String
the field signature, on standard JVM notation
signature
,
Object
the default value (null for JVM default)
value
)

Defines a new field on the target class

public void
defineMethod(String
the method name
methodName
,
int
the modifier bitmask, made by OR'ing constants from ASM's Opcodes interface
modifiers
,
String
the method signature, on standard JVM notation
signature
,
CodeBlock
the method body
methodBody
)

Defines a new method on the target class

public int
public List<JiteClass>
public String
public String
public void
setAccess(int access)

public void
setParentClassName(String parentClassName)

public void
setSourceDebug(String sourceDebug)

public void
setSourceFile(String sourceFile)

public byte[]

Returns:

the bytecode representation
toBytes
()

Convert this class representation to JDK bytecode

public byte[]

Returns:

the bytecode representation of this class
toBytes
(JDKVersion
the desired JDK version
version
)

Convert this class representation to JDK bytecode

Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAlltoStringwaitwaitwait

Field Detail

accessback to summary
private int access
annotationsback to summary
private final List<VisibleAnnotation> annotations
childClassesback to summary
private final List<JiteClass.ChildEntry> childClasses
classNameback to summary
private final String className
fieldsback to summary
private final List<FieldDefinition> fields
INTERFACESback to summary
public static final String[] INTERFACES
interfacesback to summary
private final List<String> interfaces
methodsback to summary
private final List<MethodDefinition> methods
parentClassNameback to summary
private String parentClassName
sourceDebugback to summary
private String sourceDebug
sourceFileback to summary
private String sourceFile
superClassNameback to summary
private final String superClassName

Constructor Detail

JiteClassback to summary
public JiteClass(String className)

Creates a new class representation

Parameters
className:String

the desired class name

JiteClassback to summary
public JiteClass(String className, String[] interfaces)

Creates a new class representation

Parameters
className:String

the desired class name

interfaces:String[]

the desired java interfaces this class will implement

JiteClassback to summary
public JiteClass(String className, String superClassName, String[] interfaces)

Creates a new class representation

Parameters
className:String

the desired class name

superClassName:String

the desired parent class

interfaces:String[]

the desired java interfaces this class will implement

Method Detail

addAnnotationback to summary
public void addAnnotation(VisibleAnnotation annotation)
addChildClassback to summary
public void addChildClass(JiteClass child)
addChildClassback to summary
public void addChildClass(String innerName, JiteClass child)
defineDefaultConstructorback to summary
public void defineDefaultConstructor()

Defines a default constructor on the target class

defineDefaultConstructorback to summary
public void defineDefaultConstructor(int access)
defineFieldback to summary
public FieldDefinition defineField(String fieldName, int modifiers, String signature, Object value)

Defines a new field on the target class

Parameters
fieldName:String

the field name

modifiers:int

the modifier bitmask, made by OR'ing constants from ASM's Opcodes interface

signature:String

the field signature, on standard JVM notation

value:Object

the default value (null for JVM default)

Returns:FieldDefinition

the new field definition for further modification

defineMethodback to summary
public void defineMethod(String methodName, int modifiers, String signature, CodeBlock methodBody)

Defines a new method on the target class

Parameters
methodName:String

the method name

modifiers:int

the modifier bitmask, made by OR'ing constants from ASM's Opcodes interface

signature:String

the method signature, on standard JVM notation

methodBody:CodeBlock

the method body

getAccessback to summary
public int getAccess()
getChildClassesback to summary
public List<JiteClass> getChildClasses()
getClassNameback to summary
public String getClassName()
getParentClassNameback to summary
public String getParentClassName()
setAccessback to summary
public void setAccess(int access)
setParentClassNameback to summary
public void setParentClassName(String parentClassName)
setSourceDebugback to summary
public void setSourceDebug(String sourceDebug)
setSourceFileback to summary
public void setSourceFile(String sourceFile)
toBytesback to summary
public byte[] toBytes()

Convert this class representation to JDK bytecode

Returns:byte[]

the bytecode representation

toBytesback to summary
public byte[] toBytes(JDKVersion version)

Convert this class representation to JDK bytecode

Parameters
version:JDKVersion

the desired JDK version

Returns:byte[]

the bytecode representation of this class

me.qmx.jitescript back to summary

private final Class JiteClass.ChildEntry

extends Object
Class Inheritance

Field Summary

Modifier and TypeField and Description
public final String
public final JiteClass

Constructor Summary

AccessConstructor and Description
public
ChildEntry(String innerName, JiteClass jiteClass)

Method Summary

Modifier and TypeMethod and Description
public int
public String
public String
public JiteClass
Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAlltoStringwaitwaitwait

Field Detail

innerNameback to summary
public final String innerName
jiteClassback to summary
public final JiteClass jiteClass

Constructor Detail

ChildEntryback to summary
public ChildEntry(String innerName, JiteClass jiteClass)

Method Detail

getAccessback to summary
public int getAccess()
getClassNameback to summary
public String getClassName()
getInnerNameback to summary
public String getInnerName()
getJiteClassback to summary
public JiteClass getJiteClass()