Package deltix.util.jcg.scg
Class JavaSrcGenContext
- java.lang.Object
-
- deltix.util.jcg.scg.JContextImpl
-
- deltix.util.jcg.scg.JavaSrcGenContext
-
- All Implemented Interfaces:
JContext
public class JavaSrcGenContext extends JContextImpl
Generates Java source code.
-
-
Constructor Summary
Constructors Constructor Description JavaSrcGenContext()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description JAnnotation
annotation(JTypeImpl clazz, java.lang.Object... args)
JAnnotation
annotation(java.lang.Class<?> clazz, java.lang.Object... args)
JStatement
assertStmt(JExpr passCond, JExpr message)
JExpr
classLiteral(JClass value)
JExpr
classLiteral(java.lang.Class<?> value)
JExpr
enumLiteral(java.lang.Object value)
JExpr
instanceOf(JExpr arg, JType toType)
JExpr
instanceOf(JExpr arg, java.lang.Class<?> toClass)
protected void
printModifiers(int mods, SourceCodePrinter out)
protected void
printType(java.lang.String type, SourceCodePrinter out)
protected void
printType(java.lang.String type, java.lang.String[] typeArgs, SourceCodePrinter out)
JExpr
staticCall(java.lang.Class<?> cls, java.lang.String method, java.lang.Class<?> typeArgument, JExpr... args)
java.lang.String
translateType(java.lang.String type)
JExpr
typeof(JClass type)
JExpr
typeof(java.lang.Class<?> type)
-
Methods inherited from class deltix.util.jcg.scg.JContextImpl
arrayInitializer, arrayInitializer, arrayLength, arrayTypeOf, arrayTypeOf, asType, binExpr, booleanLiteral, breakStmt, breakStmt, call, charLiteral, cn, cn, cn, cn, compStmt, condExpr, conjunction, continueStmt, disjunction, doubleLiteral, enumLiteral, falseLiteral, floatLiteral, forStmt, ifStmt, ifStmt, ifStmt, ifStmt, intLiteral, localVarRef, longLiteral, newArrayExpr, newClass, newClass, newExpr, newExpr, newGenericExpr, nullLiteral, returnStmt, staticCall, staticVarRef, staticVarRef, staticVarRef, stringLiteral, sum, supplierWithNew, thisLiteral, trueLiteral, tryStmt
-
-
-
-
Method Detail
-
classLiteral
public JExpr classLiteral(java.lang.Class<?> value)
-
assertStmt
public JStatement assertStmt(JExpr passCond, JExpr message)
-
typeof
public JExpr typeof(java.lang.Class<?> type)
-
staticCall
public JExpr staticCall(java.lang.Class<?> cls, java.lang.String method, java.lang.Class<?> typeArgument, JExpr... args)
-
enumLiteral
public JExpr enumLiteral(java.lang.Object value)
-
annotation
public JAnnotation annotation(java.lang.Class<?> clazz, java.lang.Object... args)
- Parameters:
clazz
- - the class of Annotationargs
- - Elements of the Annotation. Even elements are the keys. Odd elements are the values. One element if only value() parameter exists.- Returns:
- JAnnotation's instance
Example:
Annotationpublic @interface TODO {
will be created as
String author ();
String date ();
int currentRevision ();
String value ();
}
JContext.annotation (TODO.class, "author", "Author Name", "date", "2010-01-01", "currentRevision", 1, "value", "SOME VALUE")
Annotationpublic @interface MappedTo {
will be created as
String value ();
}
JContext.annotation ("TE$$T")
-
annotation
public JAnnotation annotation(JTypeImpl clazz, java.lang.Object... args)
-
translateType
public java.lang.String translateType(java.lang.String type)
-
printModifiers
protected void printModifiers(int mods, SourceCodePrinter out) throws java.io.IOException
- Specified by:
printModifiers
in classJContextImpl
- Throws:
java.io.IOException
-
printType
protected void printType(java.lang.String type, SourceCodePrinter out) throws java.io.IOException
- Specified by:
printType
in classJContextImpl
- Throws:
java.io.IOException
-
printType
protected void printType(java.lang.String type, java.lang.String[] typeArgs, SourceCodePrinter out) throws java.io.IOException
- Specified by:
printType
in classJContextImpl
- Throws:
java.io.IOException
-
-