public class JavaSourceCode extends AbstractSourceCode<JavaSourceCode>
Modifier and Type | Field and Description |
---|---|
protected JavaSyntax |
javaSyntax
The java syntax.
|
code, syntax, tabLevel
Constructor and Description |
---|
JavaSourceCode()
Instantiates a new java source code.
|
Modifier and Type | Method and Description |
---|---|
static StringBuilder |
addAnnotation(StringBuilder sb,
Class<?> annotationClass,
String content)
Adds the annotation.
|
JavaSourceCode |
addGenerationAnnotation(int tabLevel,
Class<?>[] generatorClasses,
String comments)
Adds the generation annotation.
|
static String |
annotation(Class<?> annotationClass)
Annotation.
|
static String |
annotation(Class<?> annotationClass,
String content)
Annotation.
|
JavaSourceCode |
class_(String className,
Class<?> superClass)
Class_.
|
JavaSourceCode |
class_(String className,
Class<?> superClass,
String superClassParams)
Class_.
|
JavaSourceCode |
class_(String className,
String genericBounds,
Class<?> superClass,
String superClassParams,
String superClassEnclosingClassParams,
String... interfaces)
Class_.
|
JavaSourceCode |
constructor_(String className,
String... params)
Constructor_.
|
JavaSourceCode |
generateNeededSerialVersionUID(Class<?> potentialSerializableClass) |
HashSet<String> |
getImports()
Gets the imports.
|
JavaSyntax |
getSyntax()
Gets the syntax.
|
JavaSourceCode |
import_(Class<?> c)
Import_.
|
JavaSourceCode |
import_(String className)
Import_.
|
JavaSourceCode |
import_static_(String importItem)
Import_static_.
|
JavaSourceCode |
import_static_allOf(Class<?> c)
Import_static_all of.
|
JavaSourceCode |
import_static_itemOf(Class<?> c,
String staticItem)
Import_static_item of.
|
static String |
importClass(Class<?> c)
Import class.
|
static StringBuilder |
importClass(StringBuilder sb,
Class<?> c)
Import class.
|
static StringBuilder |
importClass(StringBuilder sb,
String className)
Import class.
|
static StringBuilder |
importStatic(StringBuilder sb,
String importItem)
Import static.
|
JavaSourceCode |
package_(String packageString)
Package_.
|
static String |
return_(Object codeElement)
Return_.
|
JavaSourceCode |
super_(String... params)
Super_.
|
JavaSourceCode |
this_(String... params)
This_.
|
JavaSourceCode |
throws_(Class<? extends Exception>... exceptions)
Throws_.
|
JavaSourceCode |
varDecl_assign(Class<?> type,
String name,
String initValue)
Var decl_assign.
|
JavaSourceCode |
varDecl_init(Class<?> type,
String name,
String initValue)
Var decl_init.
|
JavaSourceCode |
varDecl_init(Java.Array type,
String name,
String initValue)
Var decl_init.
|
protected final JavaSyntax javaSyntax
public static String return_(Object codeElement)
codeElement
- the code elementpublic static final StringBuilder addAnnotation(StringBuilder sb, Class<?> annotationClass, String content)
sb
- the sbannotationClass
- the annotation classcontent
- the contentpublic static final String annotation(Class<?> annotationClass, String content)
annotationClass
- the annotation classcontent
- the contentpublic static final String annotation(Class<?> annotationClass)
annotationClass
- the annotation classpublic static final String importClass(Class<?> c)
c
- the cpublic static final StringBuilder importClass(StringBuilder sb, Class<?> c)
sb
- the sbc
- the cpublic static final StringBuilder importClass(StringBuilder sb, String className)
sb
- the sbclassName
- the class namepublic static final StringBuilder importStatic(StringBuilder sb, String importItem)
sb
- the sbimportItem
- the import itempublic JavaSyntax getSyntax()
getSyntax
in class AbstractSourceCode<JavaSourceCode>
public JavaSourceCode addGenerationAnnotation(int tabLevel, Class<?>[] generatorClasses, String comments)
tabLevel
- the tab levelgeneratorClasses
- the generator classescomments
- the commentspublic JavaSourceCode import_static_(String importItem)
importItem
- the import itempublic JavaSourceCode import_static_allOf(Class<?> c)
c
- the cpublic JavaSourceCode import_static_itemOf(Class<?> c, String staticItem)
c
- the cstaticItem
- the static itempublic JavaSourceCode import_(String className)
className
- the class namepublic JavaSourceCode import_(Class<?> c)
c
- the cpublic JavaSourceCode package_(String packageString) throws CodeGenException
packageString
- the package stringCodeGenException
- the code gen exceptionpublic JavaSourceCode class_(String className, String genericBounds, Class<?> superClass, String superClassParams, String superClassEnclosingClassParams, String... interfaces)
className
- the class namegenericBounds
- the generic boundssuperClass
- the super classsuperClassParams
- the super class paramssuperClassEnclosingClassParams
- the super class enclosing class paramsinterfaces
- the interfacespublic JavaSourceCode generateNeededSerialVersionUID(Class<?> potentialSerializableClass)
public JavaSourceCode class_(String className, Class<?> superClass, String superClassParams)
className
- the class namesuperClass
- the super classsuperClassParams
- the super class paramspublic JavaSourceCode class_(String className, Class<?> superClass)
className
- the class namesuperClass
- the super classpublic JavaSourceCode constructor_(String className, String... params)
className
- the class nameparams
- the paramspublic JavaSourceCode super_(String... params)
params
- the paramspublic JavaSourceCode this_(String... params)
params
- the paramspublic JavaSourceCode throws_(Class<? extends Exception>... exceptions)
exceptions
- the exceptionspublic JavaSourceCode varDecl_init(Class<?> type, String name, String initValue)
type
- the typename
- the nameinitValue
- the init valuepublic JavaSourceCode varDecl_assign(Class<?> type, String name, String initValue)
type
- the typename
- the nameinitValue
- the init valuepublic JavaSourceCode varDecl_init(Java.Array type, String name, String initValue)
type
- the typename
- the nameinitValue
- the init valueCopyright © 2003–2021 XDEV Software. All rights reserved.