Package deltix.util.jcg.scg
Class JContextImpl
- java.lang.Object
-
- deltix.util.jcg.scg.JContextImpl
-
- All Implemented Interfaces:
JContext
- Direct Known Subclasses:
CSharpSrcGenContext
,JavaSrcGenContext
public abstract class JContextImpl extends java.lang.Object implements JContext
Contains code common for Java and C# implementations.
-
-
Constructor Summary
Constructors Constructor Description JContextImpl()
-
Method Summary
All Methods Static Methods Instance Methods Abstract Methods Concrete Methods Modifier and Type Method Description JArrayInitializer
arrayInitializer(JType type)
JArrayInitializer
arrayInitializer(java.lang.Class<?> type)
JExpr
arrayLength(JExpr array)
JType
arrayTypeOf(JType type)
JType
arrayTypeOf(java.lang.Class<?> cls)
JType
asType(java.lang.Class<?> cls)
JExpr
binExpr(JExpr left, java.lang.String op, JExpr right)
JExpr
booleanLiteral(boolean value)
JStatement
breakStmt()
JStatement
breakStmt(java.lang.String label)
JExpr
call(java.lang.String method, JExpr... args)
JExpr
charLiteral(char value)
static java.lang.String
cn(JType cls)
static java.lang.String[]
cn(JType[] classes)
static java.lang.String
cn(java.lang.Class<?> cls)
static java.lang.String[]
cn(java.lang.Class<?>[] classes)
JCompoundStatement
compStmt()
JExpr
condExpr(JExpr cond, JExpr pos, JExpr neg)
JExpr
conjunction(JExpr... args)
JStatement
continueStmt()
JExpr
disjunction(JExpr... args)
JExpr
doubleLiteral(double value)
JExpr
enumLiteral(java.lang.Enum<?> value)
JExpr
falseLiteral()
JExpr
floatLiteral(float value)
JStatement
forStmt(JExpr init, JExpr condition, JExpr update, JStatement body)
JStatement
ifStmt(JExpr left, JExpr right, JStatement bothTrue, JStatement leftTrue, JStatement rightTrue, JStatement bothFalse)
JStatement
ifStmt(JExpr cond, JStatement then)
JStatement
ifStmt(JExpr cond1, JStatement then1, JExpr cond2, JExpr then2, JStatement els)
JStatement
ifStmt(JExpr cond, JStatement then, JStatement els)
JExpr
intLiteral(int value)
JExpr
localVarRef(java.lang.String fieldName)
JExpr
longLiteral(long value)
JExpr
newArrayExpr(java.lang.Class<?> cls, JExpr... elements)
ClassImpl
newClass(int modifiers, java.lang.String packageName, java.lang.String simpleName, JClass parent)
ClassImpl
newClass(int modifiers, java.lang.String packageName, java.lang.String simpleName, java.lang.Class<?> parent)
JExpr
newExpr(JType type, JExpr... args)
JExpr
newExpr(java.lang.Class<?> cls, JExpr... args)
JExpr
newGenericExpr(java.lang.Class<?> cls, JExpr... args)
JExpr
nullLiteral()
protected abstract void
printModifiers(int mods, SourceCodePrinter out)
protected abstract void
printType(java.lang.String type, SourceCodePrinter out)
protected abstract void
printType(java.lang.String type, java.lang.String[] typeArgs, SourceCodePrinter out)
JStatement
returnStmt()
JExpr
staticCall(java.lang.Class<?> cls, java.lang.String method, JExpr... args)
JExpr
staticVarRef(JClass cls, java.lang.String fieldName)
JExpr
staticVarRef(java.lang.Class<?> cls, java.lang.String fieldName)
JExpr
staticVarRef(java.lang.String cls, java.lang.String fieldName)
JExpr
stringLiteral(java.lang.String value)
JExpr
sum(JExpr... es)
JExpr
supplierWithNew(java.lang.Class<?> cls, JExpr... args)
JExpr
thisLiteral()
JExpr
trueLiteral()
JTryStatement
tryStmt()
-
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
-
Methods inherited from interface deltix.util.jcg.JContext
annotation, annotation, assertStmt, classLiteral, classLiteral, enumLiteral, ifStmt, instanceOf, instanceOf, staticCall, typeof, typeof
-
-
-
-
Method Detail
-
cn
public static java.lang.String cn(java.lang.Class<?> cls)
-
cn
public static java.lang.String[] cn(java.lang.Class<?>[] classes)
-
cn
public static java.lang.String cn(JType cls)
-
cn
public static java.lang.String[] cn(JType[] classes)
-
arrayTypeOf
public JType arrayTypeOf(java.lang.Class<?> cls)
- Specified by:
arrayTypeOf
in interfaceJContext
-
arrayTypeOf
public JType arrayTypeOf(JType type)
- Specified by:
arrayTypeOf
in interfaceJContext
-
arrayLength
public JExpr arrayLength(JExpr array)
- Specified by:
arrayLength
in interfaceJContext
-
newClass
public ClassImpl newClass(int modifiers, java.lang.String packageName, java.lang.String simpleName, java.lang.Class<?> parent)
-
newClass
public ClassImpl newClass(int modifiers, java.lang.String packageName, java.lang.String simpleName, JClass parent)
-
intLiteral
public JExpr intLiteral(int value)
- Specified by:
intLiteral
in interfaceJContext
-
longLiteral
public JExpr longLiteral(long value)
- Specified by:
longLiteral
in interfaceJContext
-
floatLiteral
public JExpr floatLiteral(float value)
- Specified by:
floatLiteral
in interfaceJContext
-
doubleLiteral
public JExpr doubleLiteral(double value)
- Specified by:
doubleLiteral
in interfaceJContext
-
stringLiteral
public JExpr stringLiteral(java.lang.String value)
- Specified by:
stringLiteral
in interfaceJContext
-
nullLiteral
public JExpr nullLiteral()
- Specified by:
nullLiteral
in interfaceJContext
-
thisLiteral
public JExpr thisLiteral()
- Specified by:
thisLiteral
in interfaceJContext
-
trueLiteral
public JExpr trueLiteral()
- Specified by:
trueLiteral
in interfaceJContext
-
falseLiteral
public JExpr falseLiteral()
- Specified by:
falseLiteral
in interfaceJContext
-
charLiteral
public JExpr charLiteral(char value)
- Specified by:
charLiteral
in interfaceJContext
-
enumLiteral
public JExpr enumLiteral(java.lang.Enum<?> value)
- Specified by:
enumLiteral
in interfaceJContext
-
ifStmt
public JStatement ifStmt(JExpr cond, JStatement then)
-
ifStmt
public JStatement ifStmt(JExpr cond, JStatement then, JStatement els)
-
ifStmt
public JStatement ifStmt(JExpr cond1, JStatement then1, JExpr cond2, JExpr then2, JStatement els)
-
ifStmt
public JStatement ifStmt(JExpr left, JExpr right, JStatement bothTrue, JStatement leftTrue, JStatement rightTrue, JStatement bothFalse)
-
conjunction
public JExpr conjunction(JExpr... args)
- Specified by:
conjunction
in interfaceJContext
-
disjunction
public JExpr disjunction(JExpr... args)
- Specified by:
disjunction
in interfaceJContext
-
staticVarRef
public JExpr staticVarRef(java.lang.Class<?> cls, java.lang.String fieldName)
- Specified by:
staticVarRef
in interfaceJContext
-
staticVarRef
public JExpr staticVarRef(java.lang.String cls, java.lang.String fieldName)
- Specified by:
staticVarRef
in interfaceJContext
-
localVarRef
public JExpr localVarRef(java.lang.String fieldName)
- Specified by:
localVarRef
in interfaceJContext
-
staticVarRef
public JExpr staticVarRef(JClass cls, java.lang.String fieldName)
- Specified by:
staticVarRef
in interfaceJContext
-
staticCall
public JExpr staticCall(java.lang.Class<?> cls, java.lang.String method, JExpr... args)
- Specified by:
staticCall
in interfaceJContext
-
returnStmt
public JStatement returnStmt()
- Specified by:
returnStmt
in interfaceJContext
-
breakStmt
public JStatement breakStmt()
-
breakStmt
public JStatement breakStmt(java.lang.String label)
-
continueStmt
public JStatement continueStmt()
- Specified by:
continueStmt
in interfaceJContext
-
newGenericExpr
public JExpr newGenericExpr(java.lang.Class<?> cls, JExpr... args)
- Specified by:
newGenericExpr
in interfaceJContext
-
supplierWithNew
public JExpr supplierWithNew(java.lang.Class<?> cls, JExpr... args)
- Specified by:
supplierWithNew
in interfaceJContext
-
newArrayExpr
public JExpr newArrayExpr(java.lang.Class<?> cls, JExpr... elements)
- Specified by:
newArrayExpr
in interfaceJContext
-
compStmt
public JCompoundStatement compStmt()
-
booleanLiteral
public JExpr booleanLiteral(boolean value)
- Specified by:
booleanLiteral
in interfaceJContext
-
tryStmt
public JTryStatement tryStmt()
-
arrayInitializer
public JArrayInitializer arrayInitializer(java.lang.Class<?> type)
- Specified by:
arrayInitializer
in interfaceJContext
-
arrayInitializer
public JArrayInitializer arrayInitializer(JType type)
- Specified by:
arrayInitializer
in interfaceJContext
-
forStmt
public JStatement forStmt(JExpr init, JExpr condition, JExpr update, JStatement body)
-
printModifiers
protected abstract void printModifiers(int mods, SourceCodePrinter out) throws java.io.IOException
- Throws:
java.io.IOException
-
printType
protected abstract void printType(java.lang.String type, SourceCodePrinter out) throws java.io.IOException
- Throws:
java.io.IOException
-
printType
protected abstract void printType(java.lang.String type, java.lang.String[] typeArgs, SourceCodePrinter out) throws java.io.IOException
- Throws:
java.io.IOException
-
-