class JClassDefSectionImpl extends java.lang.Object implements JClassDefSection, ClassContent
Modifier and Type | Field and Description |
---|---|
private java.util.ArrayList<ClassContent> |
content |
private Sectionable |
sectionable |
Constructor and Description |
---|
JClassDefSectionImpl(Sectionable sectionable) |
Modifier and Type | Method and Description |
---|---|
JClassDef |
_class(int mods,
java.lang.String name)
Add a nested class to this type.
|
JClassDef |
_enum(int mods,
java.lang.String name)
Add a nested enum to this type.
|
JClassDef |
_interface(int mods,
java.lang.String name)
Add a nested interface to this type.
|
(package private) <C extends ClassContent> |
add(C item) |
JClassDef |
annotationInterface(int mods,
java.lang.String name)
Add a nested annotation interface to this type.
|
JClassDefSection |
blankLine()
Add a blank line at this point of the type.
|
JComment |
blockComment()
Add a block comment.
|
JMethodDef |
constructor(int mods)
Add a constructor to this type.
|
JVarDeclaration |
field(int mods,
java.lang.Class<?> type,
java.lang.String name)
Add a field to this type.
|
JVarDeclaration |
field(int mods,
java.lang.Class<?> type,
java.lang.String name,
JExpr init)
Add a field to this type.
|
JVarDeclaration |
field(int mods,
JType type,
java.lang.String name)
Add a field to this type.
|
JVarDeclaration |
field(int mods,
JType type,
java.lang.String name,
JExpr init)
Add a field to this type.
|
JVarDeclaration |
field(int mods,
java.lang.String type,
java.lang.String name)
Add a field to this type.
|
JVarDeclaration |
field(int mods,
java.lang.String type,
java.lang.String name,
JExpr init)
Add a field to this type.
|
JBlock |
init()
Add a "raw" initialization block to this type definition.
|
JComment |
lineComment()
Add a line comment.
|
JMethodDef |
method(int mods,
java.lang.Class<?> returnType,
java.lang.String name)
Add a method to this type.
|
JMethodDef |
method(int mods,
JType returnType,
java.lang.String name)
Add a method to this type.
|
JMethodDef |
method(int mods,
java.lang.String returnType,
java.lang.String name)
Add a method to this type.
|
JClassDefSection |
section()
Create a section at this point, into which additional items may be added.
|
JBlock |
staticInit()
Add a static initialization block to this type definition.
|
void |
write(SourceFileWriter writer) |
private final Sectionable sectionable
private final java.util.ArrayList<ClassContent> content
JClassDefSectionImpl(Sectionable sectionable)
<C extends ClassContent> C add(C item)
public JClassDefSection section()
JClassDefSection
section
in interface JClassDefSection
public JClassDefSection blankLine()
JClassDefSection
blankLine
in interface JClassDefSection
public JBlock init()
JClassDefSection
init
in interface JClassDefSection
public JBlock staticInit()
JClassDefSection
staticInit
in interface JClassDefSection
public JVarDeclaration field(int mods, JType type, java.lang.String name)
JClassDefSection
field
in interface JClassDefSection
mods
- the modifierstype
- the field typename
- the field namepublic JVarDeclaration field(int mods, JType type, java.lang.String name, JExpr init)
JClassDefSection
field
in interface JClassDefSection
mods
- the modifierstype
- the field typename
- the field nameinit
- the field assigned valuepublic JVarDeclaration field(int mods, java.lang.Class<?> type, java.lang.String name)
JClassDefSection
field
in interface JClassDefSection
mods
- the modifierstype
- the field typename
- the field namepublic JVarDeclaration field(int mods, java.lang.Class<?> type, java.lang.String name, JExpr init)
JClassDefSection
field
in interface JClassDefSection
mods
- the modifierstype
- the field typename
- the field nameinit
- the field assigned valuepublic JVarDeclaration field(int mods, java.lang.String type, java.lang.String name)
JClassDefSection
field
in interface JClassDefSection
mods
- the modifierstype
- the field typename
- the field namepublic JVarDeclaration field(int mods, java.lang.String type, java.lang.String name, JExpr init)
JClassDefSection
field
in interface JClassDefSection
mods
- the modifierstype
- the field typename
- the field nameinit
- the field assigned valuepublic JMethodDef method(int mods, JType returnType, java.lang.String name)
JClassDefSection
method
in interface JClassDefSection
mods
- the modifiersreturnType
- the method return typename
- the method namepublic JMethodDef method(int mods, java.lang.Class<?> returnType, java.lang.String name)
JClassDefSection
method
in interface JClassDefSection
mods
- the modifiersreturnType
- the method return typename
- the method namepublic JMethodDef method(int mods, java.lang.String returnType, java.lang.String name)
JClassDefSection
method
in interface JClassDefSection
mods
- the modifiersreturnType
- the method return typename
- the method namepublic JMethodDef constructor(int mods)
JClassDefSection
constructor
in interface JClassDefSection
mods
- the modifierspublic JClassDef _class(int mods, java.lang.String name)
JClassDefSection
_class
in interface JClassDefSection
mods
- the class modifiersname
- the class namepublic JClassDef _enum(int mods, java.lang.String name)
JClassDefSection
_enum
in interface JClassDefSection
mods
- the enum modifiersname
- the enum namepublic JClassDef _interface(int mods, java.lang.String name)
JClassDefSection
_interface
in interface JClassDefSection
mods
- the interface modifiersname
- the interface namepublic JClassDef annotationInterface(int mods, java.lang.String name)
JClassDefSection
annotationInterface
in interface JClassDefSection
mods
- the annotation interface modifiersname
- the annotation interface namepublic JComment lineComment()
JCommentable
lineComment
in interface JCommentable
public JComment blockComment()
JCommentable
blockComment
in interface JCommentable
public void write(SourceFileWriter writer) throws java.io.IOException