Package org.jboss.jdeparser
Class JClassDefSectionImpl
- java.lang.Object
-
- org.jboss.jdeparser.JClassDefSectionImpl
-
- All Implemented Interfaces:
ClassContent
,JClassDefSection
,JCommentable
,Writable
class JClassDefSectionImpl extends java.lang.Object implements JClassDefSection, ClassContent
-
-
Field Summary
Fields Modifier and Type Field Description private java.util.ArrayList<ClassContent>
content
private Sectionable
sectionable
-
Constructor Summary
Constructors Constructor Description JClassDefSectionImpl(Sectionable sectionable)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method 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>
Cadd(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, 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.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.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, java.lang.String 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.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)
-
-
-
Field Detail
-
sectionable
private final Sectionable sectionable
-
content
private final java.util.ArrayList<ClassContent> content
-
-
Constructor Detail
-
JClassDefSectionImpl
JClassDefSectionImpl(Sectionable sectionable)
-
-
Method Detail
-
add
<C extends ClassContent> C add(C item)
-
section
public JClassDefSection section()
Description copied from interface:JClassDefSection
Create a section at this point, into which additional items may be added.- Specified by:
section
in interfaceJClassDefSection
- Returns:
- the new section to add
-
blankLine
public JClassDefSection blankLine()
Description copied from interface:JClassDefSection
Add a blank line at this point of the type.- Specified by:
blankLine
in interfaceJClassDefSection
- Returns:
- this type definition
-
init
public JBlock init()
Description copied from interface:JClassDefSection
Add a "raw" initialization block to this type definition.- Specified by:
init
in interfaceJClassDefSection
- Returns:
- the initialization block
-
staticInit
public JBlock staticInit()
Description copied from interface:JClassDefSection
Add a static initialization block to this type definition.- Specified by:
staticInit
in interfaceJClassDefSection
- Returns:
- the static initialization block
-
field
public JVarDeclaration field(int mods, JType type, java.lang.String name)
Description copied from interface:JClassDefSection
Add a field to this type.- Specified by:
field
in interfaceJClassDefSection
- Parameters:
mods
- the modifierstype
- the field typename
- the field name- Returns:
- the field declaration
-
field
public JVarDeclaration field(int mods, JType type, java.lang.String name, JExpr init)
Description copied from interface:JClassDefSection
Add a field to this type.- Specified by:
field
in interfaceJClassDefSection
- Parameters:
mods
- the modifierstype
- the field typename
- the field nameinit
- the field assigned value- Returns:
- the field declaration
-
field
public JVarDeclaration field(int mods, java.lang.Class<?> type, java.lang.String name)
Description copied from interface:JClassDefSection
Add a field to this type.- Specified by:
field
in interfaceJClassDefSection
- Parameters:
mods
- the modifierstype
- the field typename
- the field name- Returns:
- the field declaration
-
field
public JVarDeclaration field(int mods, java.lang.Class<?> type, java.lang.String name, JExpr init)
Description copied from interface:JClassDefSection
Add a field to this type.- Specified by:
field
in interfaceJClassDefSection
- Parameters:
mods
- the modifierstype
- the field typename
- the field nameinit
- the field assigned value- Returns:
- the field declaration
-
field
public JVarDeclaration field(int mods, java.lang.String type, java.lang.String name)
Description copied from interface:JClassDefSection
Add a field to this type.- Specified by:
field
in interfaceJClassDefSection
- Parameters:
mods
- the modifierstype
- the field typename
- the field name- Returns:
- the field declaration
-
field
public JVarDeclaration field(int mods, java.lang.String type, java.lang.String name, JExpr init)
Description copied from interface:JClassDefSection
Add a field to this type.- Specified by:
field
in interfaceJClassDefSection
- Parameters:
mods
- the modifierstype
- the field typename
- the field nameinit
- the field assigned value- Returns:
- the field declaration
-
method
public JMethodDef method(int mods, JType returnType, java.lang.String name)
Description copied from interface:JClassDefSection
Add a method to this type.- Specified by:
method
in interfaceJClassDefSection
- Parameters:
mods
- the modifiersreturnType
- the method return typename
- the method name- Returns:
- the method definition
-
method
public JMethodDef method(int mods, java.lang.Class<?> returnType, java.lang.String name)
Description copied from interface:JClassDefSection
Add a method to this type.- Specified by:
method
in interfaceJClassDefSection
- Parameters:
mods
- the modifiersreturnType
- the method return typename
- the method name- Returns:
- the method definition
-
method
public JMethodDef method(int mods, java.lang.String returnType, java.lang.String name)
Description copied from interface:JClassDefSection
Add a method to this type.- Specified by:
method
in interfaceJClassDefSection
- Parameters:
mods
- the modifiersreturnType
- the method return typename
- the method name- Returns:
- the method definition
-
constructor
public JMethodDef constructor(int mods)
Description copied from interface:JClassDefSection
Add a constructor to this type.- Specified by:
constructor
in interfaceJClassDefSection
- Parameters:
mods
- the modifiers- Returns:
- the constructor definition
-
_class
public JClassDef _class(int mods, java.lang.String name)
Description copied from interface:JClassDefSection
Add a nested class to this type.- Specified by:
_class
in interfaceJClassDefSection
- Parameters:
mods
- the class modifiersname
- the class name- Returns:
- the nested class
-
_enum
public JClassDef _enum(int mods, java.lang.String name)
Description copied from interface:JClassDefSection
Add a nested enum to this type.- Specified by:
_enum
in interfaceJClassDefSection
- Parameters:
mods
- the enum modifiersname
- the enum name- Returns:
- the nested enum
-
_interface
public JClassDef _interface(int mods, java.lang.String name)
Description copied from interface:JClassDefSection
Add a nested interface to this type.- Specified by:
_interface
in interfaceJClassDefSection
- Parameters:
mods
- the interface modifiersname
- the interface name- Returns:
- the nested interface
-
annotationInterface
public JClassDef annotationInterface(int mods, java.lang.String name)
Description copied from interface:JClassDefSection
Add a nested annotation interface to this type.- Specified by:
annotationInterface
in interfaceJClassDefSection
- Parameters:
mods
- the annotation interface modifiersname
- the annotation interface name- Returns:
- the nested annotation interface
-
lineComment
public JComment lineComment()
Description copied from interface:JCommentable
Add a line comment.- Specified by:
lineComment
in interfaceJCommentable
- Returns:
- the line comment body
-
blockComment
public JComment blockComment()
Description copied from interface:JCommentable
Add a block comment.- Specified by:
blockComment
in interfaceJCommentable
- Returns:
- the block comment body
-
write
public void write(SourceFileWriter writer) throws java.io.IOException
-
-