public abstract class VirtualMachine extends Object
VirtualMachine
acts as a factory method for
CompilationUnit
, Type
, Literal
, and
Expression
objects. Most Statement
factory methods are
located on Block
; most Declaration
factory methods are
located on the objects that contain them.Constructor and Description |
---|
VirtualMachine() |
Modifier and Type | Method and Description |
---|---|
abstract VirtualMachine |
clear()
Removes all cached compilationUnits.
|
abstract VirtualMachine |
encode()
Writes out the source code to all enclosed
CompilationUnit
instances. |
abstract CompilationUnitEncoder |
getEncoder() |
static VirtualMachine |
getVirtualMachine()
Returns the default
VirtualMachine implementation previously set
using the static setVirtualMachine(VirtualMachine) method OR
returns the reference implementation ( com.inxar.jenesis.MVM . |
abstract FieldAccess |
newAccess(Class<?> qualifierClass,
Object object) |
abstract FieldAccess |
newAccess(Expression qualifier,
String name)
Expression factory method which returns a new field access with
the given qualifier and name. |
abstract FieldAccess |
newAccess(String name)
Expression factory method which returns a new field access with
the given qualifier and name. |
abstract FieldAccess |
newAccess(String qualifier,
String name)
Expression factory method which returns a new field access with
the given qualifier and name. |
abstract Annotation |
newAnnotation(Class<?> annotationClass) |
abstract Annotation |
newAnnotation(String text)
Creates a new annotation with the given name.
|
abstract AnnotationAttribute |
newAnnotationAttribute(String key,
Expression value,
Expression... additionalValues)
Creates a new annotation attribute with the given name and the given
value.
|
abstract NewAnonymousClass |
newAnon(Type type)
Expression factory method which returns a new anonymous class
instance creation expression for the given type. |
abstract NewAnonymousClass |
newAnon(Type type,
Comparator comparator) |
abstract NewAnonymousClass |
newAnonymousClass(String className,
Comparator comparator,
String... genericTypes) |
abstract NewAnonymousClass |
newAnonymousClass(String className,
String... genericTypes) |
abstract ArrayType |
newArray(int type,
int dims)
Type factory method which returns an array of primitive type with
the given constant and dimensions. |
abstract ArrayType |
newArray(String type,
int dims)
Type factory method which returns an array of class type with the
given name and dimensions. |
abstract NewArray |
newArray(Type type)
Expression factory method which returns a new array instance
creation expression for the given type. |
abstract ArrayAccess |
newArrayAccess(Expression qual,
String name)
Expression factory method which returns a new array access
expression with the given qualifier and name. |
abstract ArrayAccess |
newArrayAccess(String name)
Expression factory method which returns a new array access
expression with the given qualifier and name. |
abstract ArrayAccess |
newArrayAccess(String qual,
String name)
Expression factory method which returns a new array access
expression with the given qualifier and name. |
abstract ArrayInitializer |
newArrayInit(Expression[] expressions)
Expression factory method which returns a new array initializer
with the given arguments. |
abstract ArrayInitializer |
newArrayInit(Object o)
Expression factory method which returns a new array initializer
with the given arguments. |
abstract Assign |
newAssign(int type,
Variable left,
Expression right)
Expression factory method which returns a new assignment of the
given type. |
abstract Assign |
newAssign(Variable left,
Expression right)
Expression factory method which returns a new assignment of the
SIMPLE type. |
abstract Binary |
newBinary(int type,
Expression left,
Expression right)
Expression factory method which returns a new unary function of
the given type. |
abstract Blank |
newBlank()
Expression factory method which returns the blank expression. |
abstract BooleanLiteral |
newBoolean(boolean value)
Literal factory method which returns a new boolean
literal. |
abstract Cast |
newBrackets(Expression value)
Expression factory method which returns a new expression that
wraps brackets around the expression. |
abstract ByteLiteral |
newByte(byte val)
Literal factory method which returns a new byte literal. |
abstract CalendarClassType |
newCalendarType(String pattern)
Type factory method which returns a calendar type with the given
pattern as representation storage. |
abstract Cast |
newCast(Type type,
Expression value)
Expression factory method which returns a new cast function
having the given type and value. |
abstract CharLiteral |
newChar(char val)
Literal factory method which returns a new char literal. |
abstract NewClass |
newClass(Type type)
Expression factory method which returns a new class instance
creation expression for the given type. |
abstract ClassLiteral |
newClassLiteral(ClassType type)
Literal factory method which returns a new Class literal. |
abstract ClassLiteral |
newClassLiteral(String className)
Literal factory method which returns a new Class literal. |
abstract CompilationUnit |
newCompilationUnit(String sourcepath)
Creates a new
CompilationUnit in this Machine and returns
it. |
abstract CompilationUnit |
newCompilationUnit(String sourceDirectory,
String packageName)
Creates a new
CompilationUnit in this Machine sets the
namespace and returns it. |
abstract DoubleLiteral |
newDouble(double val)
Literal factory method which returns a new double
literal. |
abstract False |
newFalse()
Literal factory method which returns the boolean false
literal. |
abstract FloatLiteral |
newFloat(float val)
Literal factory method which returns a new float literal. |
abstract Freeform |
newFree(String code)
Expression factory method which returns a new freeform expression
with the given code. |
abstract IntLiteral |
newInt(int val)
Literal factory method which returns a new int literal. |
abstract Invoke |
newInvoke(Class<?> qualifyingClass,
String name) |
abstract Invoke |
newInvoke(Expression qualifier,
String name)
Expression factory method which returns a new method invocation
with the given qualifier and name. |
abstract Invoke |
newInvoke(String name)
Expression factory method which returns a new method invocation
with the given qualifier and name. |
abstract Invoke |
newInvoke(String qualifier,
String name)
Expression factory method which returns a new method invocation
with the given qualifier and name. |
abstract LongLiteral |
newLong(long val)
Literal factory method which returns a new long literal. |
abstract Null |
newNull()
Literal factory method which returns the null literal. |
abstract OctalLiteral |
newOctal(char val)
Literal factory method which returns a new octal char
literal. |
abstract ScientificLiteral |
newScientific(int precision,
int scale,
int exponent)
Literal factory method which returns a new scientific floating
point char literal. |
abstract ShortLiteral |
newShort(short val)
Literal factory method which returns a new short literal. |
abstract ClassType |
newSimpleType(Class<?> type) |
abstract StringLiteral |
newString(String val)
Literal factory method which returns a new String
literal. |
abstract Super |
newSuper() |
abstract Ternary |
newTernary(int type,
Expression one,
Expression two,
Expression three)
Expression factory method which returns a new unary function of
the given type. |
abstract This |
newThis() |
abstract This |
newThis(ClassType typeOfOuterClass) |
abstract True |
newTrue()
Literal factory method which returns the boolean true
literal. |
abstract ClassType |
newType(Class<?> clazz)
Type factory method which returns a class type named with the
given Class . |
abstract PrimitiveType |
newType(int type)
Type factory method which returns a primitive type named by the
given int as allowed by the constants listed in the Type
interface. |
abstract ClassType |
newType(String name)
Type factory method which returns a class type named with the
given String . |
abstract Unary |
newUnary(int type,
Expression value)
Expression factory method which returns a new unary function of
the given type. |
abstract UnicodeLiteral |
newUnicode(char val)
Literal factory method which returns a new unicode char
literal. |
abstract Variable |
newVar(String name)
Expression factory method which returns a new variable with the
given name. |
abstract Variable |
newVar(Type type)
Expression factory method which returns a new variable with the
given name. |
static VirtualMachine |
setVirtualMachine(VirtualMachine vm)
Sets the default
VirtualMachine implementation. |
abstract Type |
type_boolean() |
abstract Type |
type_byte() |
abstract Type |
type_char() |
abstract Type |
type_double() |
abstract Type |
type_float() |
abstract Type |
type_int() |
abstract Type |
type_long() |
abstract Type |
type_short() |
abstract Type |
type_void() |
abstract ClassType |
typeBigDecimal() |
abstract ClassType |
typeBoolean() |
abstract ClassType |
typeCalendar() |
abstract ClassType |
typeInteger() |
abstract ClassType |
typeLong() |
abstract ClassType |
typeString() |
public static VirtualMachine getVirtualMachine()
VirtualMachine
implementation previously set
using the static setVirtualMachine(VirtualMachine)
method OR
returns the reference implementation ( com.inxar.jenesis.MVM
. public static VirtualMachine setVirtualMachine(VirtualMachine vm)
VirtualMachine
implementation.public abstract VirtualMachine clear()
public abstract VirtualMachine encode()
CompilationUnit
instances.public abstract CompilationUnitEncoder getEncoder()
public abstract FieldAccess newAccess(Class<?> qualifierClass, Object object)
public abstract FieldAccess newAccess(Expression qualifier, String name)
Expression
factory method which returns a new field access with
the given qualifier and name.public abstract FieldAccess newAccess(String name)
Expression
factory method which returns a new field access with
the given qualifier and name.public abstract FieldAccess newAccess(String qualifier, String name)
Expression
factory method which returns a new field access with
the given qualifier and name.public abstract Annotation newAnnotation(Class<?> annotationClass)
public abstract Annotation newAnnotation(String text)
@Example
.text
- The name of the annotation. Must not start with "@".public abstract AnnotationAttribute newAnnotationAttribute(String key, Expression value, Expression... additionalValues)
public abstract NewAnonymousClass newAnon(Type type)
Expression
factory method which returns a new anonymous class
instance creation expression for the given type.public abstract NewAnonymousClass newAnon(Type type, Comparator comparator)
public abstract NewAnonymousClass newAnonymousClass(String className, String... genericTypes)
public abstract NewAnonymousClass newAnonymousClass(String className, Comparator comparator, String... genericTypes)
public abstract ArrayType newArray(int type, int dims)
Type
factory method which returns an array of primitive type with
the given constant and dimensions.public abstract ArrayType newArray(String type, int dims)
Type
factory method which returns an array of class type with the
given name and dimensions.public abstract NewArray newArray(Type type)
Expression
factory method which returns a new array instance
creation expression for the given type.public abstract ArrayAccess newArrayAccess(Expression qual, String name)
Expression
factory method which returns a new array access
expression with the given qualifier and name.public abstract ArrayAccess newArrayAccess(String name)
Expression
factory method which returns a new array access
expression with the given qualifier and name.public abstract ArrayAccess newArrayAccess(String qual, String name)
Expression
factory method which returns a new array access
expression with the given qualifier and name.public abstract ArrayInitializer newArrayInit(Expression[] expressions)
Expression
factory method which returns a new array initializer
with the given arguments.public abstract ArrayInitializer newArrayInit(Object o)
Expression
factory method which returns a new array initializer
with the given arguments.public abstract Assign newAssign(int type, Variable left, Expression right)
Expression
factory method which returns a new assignment of the
given type.public abstract Assign newAssign(Variable left, Expression right)
Expression
factory method which returns a new assignment of the
SIMPLE type. This is a convenience * method.public abstract Binary newBinary(int type, Expression left, Expression right)
Expression
factory method which returns a new unary function of
the given type.public abstract Blank newBlank()
Expression
factory method which returns the blank expression.public abstract BooleanLiteral newBoolean(boolean value)
Literal
factory method which returns a new boolean
literal.public abstract Cast newBrackets(Expression value)
Expression
factory method which returns a new expression that
wraps brackets around the expression.public abstract ByteLiteral newByte(byte val)
Literal
factory method which returns a new byte
literal.public abstract CalendarClassType newCalendarType(String pattern)
Type
factory method which returns a calendar type with the given
pattern as representation storage.public abstract Cast newCast(Type type, Expression value)
Expression
factory method which returns a new cast function
having the given type and value.public abstract CharLiteral newChar(char val)
Literal
factory method which returns a new char
literal.public abstract NewClass newClass(Type type)
Expression
factory method which returns a new class instance
creation expression for the given type.public abstract ClassLiteral newClassLiteral(ClassType type)
Literal
factory method which returns a new Class
literal.public abstract ClassLiteral newClassLiteral(String className)
Literal
factory method which returns a new Class
literal.public abstract CompilationUnit newCompilationUnit(String sourcepath)
CompilationUnit
in this Machine
and returns
it.public abstract CompilationUnit newCompilationUnit(String sourceDirectory, String packageName)
CompilationUnit
in this Machine
sets the
namespace and returns it.public abstract DoubleLiteral newDouble(double val)
Literal
factory method which returns a new double
literal.public abstract False newFalse()
Literal
factory method which returns the boolean false
literal.public abstract FloatLiteral newFloat(float val)
Literal
factory method which returns a new float
literal.public abstract Freeform newFree(String code)
Expression
factory method which returns a new freeform expression
with the given code.public abstract IntLiteral newInt(int val)
Literal
factory method which returns a new int
literal.public abstract Invoke newInvoke(Expression qualifier, String name)
Expression
factory method which returns a new method invocation
with the given qualifier and name.public abstract Invoke newInvoke(String name)
Expression
factory method which returns a new method invocation
with the given qualifier and name.public abstract Invoke newInvoke(String qualifier, String name)
Expression
factory method which returns a new method invocation
with the given qualifier and name.public abstract LongLiteral newLong(long val)
Literal
factory method which returns a new long
literal.public abstract Null newNull()
Literal
factory method which returns the null
literal.public abstract OctalLiteral newOctal(char val)
Literal
factory method which returns a new octal char
literal.public abstract ScientificLiteral newScientific(int precision, int scale, int exponent)
Literal
factory method which returns a new scientific floating
point char
literal.public abstract ShortLiteral newShort(short val)
Literal
factory method which returns a new short
literal.public abstract StringLiteral newString(String val)
Literal
factory method which returns a new String
literal.public abstract Ternary newTernary(int type, Expression one, Expression two, Expression three)
Expression
factory method which returns a new unary function of
the given type.public abstract True newTrue()
Literal
factory method which returns the boolean true
literal.public abstract ClassType newType(Class<?> clazz)
Type
factory method which returns a class type named with the
given Class
.public abstract PrimitiveType newType(int type)
Type
factory method which returns a primitive type named by the
given int
as allowed by the constants listed in the Type
interface.type
- A primitive type constant. Must not be array or class.public abstract ClassType newType(String name)
Type
factory method which returns a class type named with the
given String
.public abstract Unary newUnary(int type, Expression value)
Expression
factory method which returns a new unary function of
the given type.public abstract UnicodeLiteral newUnicode(char val)
Literal
factory method which returns a new unicode char
literal.public abstract Variable newVar(String name)
Expression
factory method which returns a new variable with the
given name.public abstract Variable newVar(Type type)
Expression
factory method which returns a new variable with the
given name.public abstract This newThis()
public abstract Type type_boolean()
public abstract Type type_byte()
public abstract Type type_char()
public abstract Type type_double()
public abstract Type type_float()
public abstract Type type_int()
public abstract Type type_long()
public abstract Type type_short()
public abstract Type type_void()
public abstract ClassType typeBigDecimal()
public abstract ClassType typeBoolean()
public abstract ClassType typeCalendar()
public abstract ClassType typeInteger()
public abstract ClassType typeLong()
public abstract ClassType typeString()
public abstract Super newSuper()
Copyright © 2000–2018 jenesis4java. All rights reserved.