abstract class AbstractJClassDef extends AbstractJGeneric implements JClassDef, ClassFileContent, ClassContent, Sectionable
Modifier and Type | Field and Description |
---|---|
private JType |
_extends |
private java.util.ArrayList<JType> |
_implements |
private ImplJSourceFile |
classFile |
private java.util.ArrayList<ClassContent> |
content |
private AbstractJClassDef |
enclosingClass |
private JType |
erased |
private JType |
generic |
private int |
mods |
private java.lang.String |
name |
Constructor and Description |
---|
AbstractJClassDef(int mods,
AbstractJClassDef enclosingClass,
java.lang.String name) |
AbstractJClassDef(int mods,
ImplJSourceFile classFile,
java.lang.String name) |
AbstractJClassDef(int mods,
java.lang.String name) |
Modifier and Type | Method and Description |
---|---|
JClassDef |
_class(java.util.ArrayList<ClassContent> content,
int mods,
java.lang.String name) |
JClassDef |
_class(int mods,
java.lang.String name)
Add a nested class to this type.
|
JClassDef |
_enum(java.util.ArrayList<ClassContent> content,
int mods,
java.lang.String name) |
JClassDef |
_enum(int mods,
java.lang.String name)
Add a nested enum to this type.
|
JEnumConstant |
_enum(java.lang.String name)
Add an enum constant.
|
JClassDef |
_extends(java.lang.Class<?> clazz)
Add an
extends type to this type. |
JClassDef |
_extends(JType type)
Add an
extends type to this type. |
JClassDef |
_extends(java.lang.String name)
Add an
extends type to this type. |
JClassDef |
_implements(java.lang.Class<?>... classes)
Add one or more
implements type(s) to this type. |
JClassDef |
_implements(JType... types)
Add one or more
implements type(s) to this type. |
JClassDef |
_implements(java.lang.String... names)
Add one or more
implements type(s) to this type. |
JClassDef |
_interface(java.util.ArrayList<ClassContent> content,
int mods,
java.lang.String name) |
JClassDef |
_interface(int mods,
java.lang.String name)
Add a nested interface to this type.
|
(package private) <C extends ClassContent> |
add(java.util.ArrayList<ClassContent> content,
C item) |
(package private) <C extends ClassContent> |
add(C item) |
JClassDef |
annotationInterface(java.util.ArrayList<ClassContent> content,
int mods,
java.lang.String name) |
JClassDef |
annotationInterface(int mods,
java.lang.String name)
Add a nested annotation interface to this type.
|
JClassDef |
blankLine()
Add a blank line at this point of the type.
|
JMethodDef |
constructor(java.util.ArrayList<ClassContent> content,
int mods) |
JMethodDef |
constructor(int mods)
Add a constructor to this type.
|
(package private) abstract Tokens.$KW |
designation() |
JType |
erasedType()
Get the erased type corresponding to this type definition.
|
JVarDeclaration |
field(java.util.ArrayList<ClassContent> content,
int mods,
JType type,
java.lang.String name,
JExpr init) |
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.
|
JType |
genericType()
Get a generic type for this type definition, where the type arguments are the same as the type parameters of this
type (as defined at the time this method is called).
|
(package private) ImplJSourceFile |
getClassFile() |
(package private) java.lang.Iterable<ClassContent> |
getContent() |
(package private) AbstractJClassDef |
getEnclosingClass() |
(package private) JType |
getExtends() |
(package private) java.lang.Iterable<JType> |
getImplements() |
(package private) FormatPreferences.Indentation |
getMemberIndentation() |
int |
getModifiers() |
(package private) int |
getMods() |
(package private) java.lang.String |
getName() |
boolean |
hasAllModifiers(int mods) |
boolean |
hasAnyModifier(int mods) |
(package private) boolean |
hasInterfaceStyleExtends() |
JBlock |
init()
Add a "raw" initialization block to this type definition.
|
JBlock |
init(java.util.ArrayList<ClassContent> content) |
JMethodDef |
method(java.util.ArrayList<ClassContent> content,
int mods,
JType returnType,
java.lang.String name) |
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.
|
(package private) boolean |
methodCanHaveBody(int mods) |
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.
|
JBlock |
staticInit(java.util.ArrayList<ClassContent> content) |
(package private) boolean |
supportsCompactInitOnly() |
JTypeParamDef |
typeParam(java.lang.String name)
Define a type parameter.
|
void |
write(SourceFileWriter writer) |
(package private) void |
writeClassHeader(SourceFileWriter sourceFileWriter) |
(package private) void |
writeContent(SourceFileWriter sourceFileWriter) |
(package private) void |
writeContentBlock(SourceFileWriter sourceFileWriter) |
typeParams, typeParamsToArgs, writeTypeParams
annotate, annotate, annotate, writeAnnotations
deprecated, docComment, writeDocComments
blockComment, lineComment, writeComments
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
annotate, annotate, annotate
deprecated, docComment
typeParams
blockComment, lineComment
private final int mods
private final java.lang.String name
private final AbstractJClassDef enclosingClass
private final ImplJSourceFile classFile
private final java.util.ArrayList<ClassContent> content
private JType _extends
private java.util.ArrayList<JType> _implements
private JType erased
private JType generic
AbstractJClassDef(int mods, java.lang.String name)
AbstractJClassDef(int mods, AbstractJClassDef enclosingClass, java.lang.String name)
AbstractJClassDef(int mods, ImplJSourceFile classFile, java.lang.String name)
AbstractJClassDef getEnclosingClass()
ImplJSourceFile getClassFile()
int getMods()
java.lang.String getName()
<C extends ClassContent> C add(C item)
<C extends ClassContent> C add(java.util.ArrayList<ClassContent> content, C item)
public JClassDefSection section()
JClassDefSection
section
in interface JClassDefSection
public JClassDef _extends(java.lang.String name)
JClassDef
extends
type to this type.public JClassDef _extends(JType type)
JClassDef
extends
type to this type.public JClassDef _extends(java.lang.Class<?> clazz)
JClassDef
extends
type to this type.public JClassDef _implements(java.lang.String... names)
JClassDef
implements
type(s) to this type._implements
in interface JClassDef
names
- the type namepublic JClassDef _implements(JType... types)
JClassDef
implements
type(s) to this type._implements
in interface JClassDef
types
- the typepublic JClassDef _implements(java.lang.Class<?>... classes)
JClassDef
implements
type(s) to this type._implements
in interface JClassDef
classes
- the typepublic JClassDef blankLine()
JClassDef
blankLine
in interface JClassDef
blankLine
in interface JClassDefSection
public JType erasedType()
JClassDef
erasedType
in interface JClassDef
public JType genericType()
JClassDef
genericType
in interface JClassDef
public JTypeParamDef typeParam(java.lang.String name)
JGenericDef
typeParam
in interface JGenericDef
typeParam
in class AbstractJGeneric
name
- the type parameter namepublic final JBlock init()
JClassDefSection
init
in interface JClassDefSection
public JBlock init(java.util.ArrayList<ClassContent> content)
init
in interface Sectionable
public final JBlock staticInit()
JClassDefSection
staticInit
in interface JClassDefSection
public JBlock staticInit(java.util.ArrayList<ClassContent> content)
staticInit
in interface Sectionable
public JEnumConstant _enum(java.lang.String name)
JClassDef
public JVarDeclaration field(java.util.ArrayList<ClassContent> content, int mods, JType type, java.lang.String name, JExpr init)
field
in interface Sectionable
public final JVarDeclaration field(int mods, JType type, java.lang.String name)
JClassDefSection
field
in interface JClassDefSection
mods
- the modifierstype
- the field typename
- the field namepublic final 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 final 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 final 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 final 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 final 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(java.util.ArrayList<ClassContent> content, int mods, JType returnType, java.lang.String name)
method
in interface Sectionable
public final 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 final 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 final 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 nameboolean methodCanHaveBody(int mods)
boolean hasInterfaceStyleExtends()
boolean supportsCompactInitOnly()
public JMethodDef constructor(java.util.ArrayList<ClassContent> content, int mods)
constructor
in interface Sectionable
public final JMethodDef constructor(int mods)
JClassDefSection
constructor
in interface JClassDefSection
mods
- the modifierspublic JClassDef _class(java.util.ArrayList<ClassContent> content, int mods, java.lang.String name)
_class
in interface Sectionable
public JClassDef _enum(java.util.ArrayList<ClassContent> content, int mods, java.lang.String name)
_enum
in interface Sectionable
public JClassDef _interface(java.util.ArrayList<ClassContent> content, int mods, java.lang.String name)
_interface
in interface Sectionable
public JClassDef annotationInterface(java.util.ArrayList<ClassContent> content, int mods, java.lang.String name)
annotationInterface
in interface Sectionable
public final JClassDef _class(int mods, java.lang.String name)
JClassDefSection
_class
in interface JClassDefSection
mods
- the class modifiersname
- the class namepublic final JClassDef _enum(int mods, java.lang.String name)
JClassDefSection
_enum
in interface JClassDefSection
mods
- the enum modifiersname
- the enum namepublic final JClassDef _interface(int mods, java.lang.String name)
JClassDefSection
_interface
in interface JClassDefSection
mods
- the interface modifiersname
- the interface namepublic final JClassDef annotationInterface(int mods, java.lang.String name)
JClassDefSection
annotationInterface
in interface JClassDefSection
mods
- the annotation interface modifiersname
- the annotation interface namejava.lang.Iterable<ClassContent> getContent()
JType getExtends()
java.lang.Iterable<JType> getImplements()
abstract Tokens.$KW designation()
FormatPreferences.Indentation getMemberIndentation()
public void write(SourceFileWriter writer) throws java.io.IOException
void writeContentBlock(SourceFileWriter sourceFileWriter) throws java.io.IOException
java.io.IOException
void writeClassHeader(SourceFileWriter sourceFileWriter) throws java.io.IOException
java.io.IOException
void writeContent(SourceFileWriter sourceFileWriter) throws java.io.IOException
java.io.IOException
public int getModifiers()
public boolean hasAllModifiers(int mods)
public boolean hasAnyModifier(int mods)