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, writeTypeParamsannotate, annotate, annotate, writeAnnotationsdeprecated, docComment, writeDocCommentsblockComment, lineComment, writeCommentsclone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitannotate, annotate, annotatedeprecated, docCommenttypeParamsblockComment, lineCommentprivate 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()
JClassDefSectionsection in interface JClassDefSectionpublic JClassDef _extends(java.lang.String name)
JClassDefextends type to this type.public JClassDef _extends(JType type)
JClassDefextends type to this type.public JClassDef _extends(java.lang.Class<?> clazz)
JClassDefextends type to this type.public JClassDef _implements(java.lang.String... names)
JClassDefimplements type(s) to this type._implements in interface JClassDefnames - the type namepublic JClassDef _implements(JType... types)
JClassDefimplements type(s) to this type._implements in interface JClassDeftypes - the typepublic JClassDef _implements(java.lang.Class<?>... classes)
JClassDefimplements type(s) to this type._implements in interface JClassDefclasses - the typepublic JClassDef blankLine()
JClassDefblankLine in interface JClassDefblankLine in interface JClassDefSectionpublic JType erasedType()
JClassDeferasedType in interface JClassDefpublic JType genericType()
JClassDefgenericType in interface JClassDefpublic JTypeParamDef typeParam(java.lang.String name)
JGenericDeftypeParam in interface JGenericDeftypeParam in class AbstractJGenericname - the type parameter namepublic final JBlock init()
JClassDefSectioninit in interface JClassDefSectionpublic JBlock init(java.util.ArrayList<ClassContent> content)
init in interface Sectionablepublic final JBlock staticInit()
JClassDefSectionstaticInit in interface JClassDefSectionpublic JBlock staticInit(java.util.ArrayList<ClassContent> content)
staticInit in interface Sectionablepublic JEnumConstant _enum(java.lang.String name)
JClassDefpublic JVarDeclaration field(java.util.ArrayList<ClassContent> content, int mods, JType type, java.lang.String name, JExpr init)
field in interface Sectionablepublic final JVarDeclaration field(int mods, JType type, java.lang.String name)
JClassDefSectionfield in interface JClassDefSectionmods - the modifierstype - the field typename - the field namepublic final JVarDeclaration field(int mods, JType type, java.lang.String name, JExpr init)
JClassDefSectionfield in interface JClassDefSectionmods - 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)
JClassDefSectionfield in interface JClassDefSectionmods - the modifierstype - the field typename - the field namepublic final JVarDeclaration field(int mods, java.lang.Class<?> type, java.lang.String name, JExpr init)
JClassDefSectionfield in interface JClassDefSectionmods - 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)
JClassDefSectionfield in interface JClassDefSectionmods - the modifierstype - the field typename - the field namepublic final JVarDeclaration field(int mods, java.lang.String type, java.lang.String name, JExpr init)
JClassDefSectionfield in interface JClassDefSectionmods - 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 Sectionablepublic final JMethodDef method(int mods, JType returnType, java.lang.String name)
JClassDefSectionmethod in interface JClassDefSectionmods - the modifiersreturnType - the method return typename - the method namepublic final JMethodDef method(int mods, java.lang.Class<?> returnType, java.lang.String name)
JClassDefSectionmethod in interface JClassDefSectionmods - the modifiersreturnType - the method return typename - the method namepublic final JMethodDef method(int mods, java.lang.String returnType, java.lang.String name)
JClassDefSectionmethod in interface JClassDefSectionmods - 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 Sectionablepublic final JMethodDef constructor(int mods)
JClassDefSectionconstructor in interface JClassDefSectionmods - the modifierspublic JClassDef _class(java.util.ArrayList<ClassContent> content, int mods, java.lang.String name)
_class in interface Sectionablepublic JClassDef _enum(java.util.ArrayList<ClassContent> content, int mods, java.lang.String name)
_enum in interface Sectionablepublic JClassDef _interface(java.util.ArrayList<ClassContent> content, int mods, java.lang.String name)
_interface in interface Sectionablepublic JClassDef annotationInterface(java.util.ArrayList<ClassContent> content, int mods, java.lang.String name)
annotationInterface in interface Sectionablepublic final JClassDef _class(int mods, java.lang.String name)
JClassDefSection_class in interface JClassDefSectionmods - the class modifiersname - the class namepublic final JClassDef _enum(int mods, java.lang.String name)
JClassDefSection_enum in interface JClassDefSectionmods - the enum modifiersname - the enum namepublic final JClassDef _interface(int mods, java.lang.String name)
JClassDefSection_interface in interface JClassDefSectionmods - the interface modifiersname - the interface namepublic final JClassDef annotationInterface(int mods, java.lang.String name)
JClassDefSectionannotationInterface in interface JClassDefSectionmods - 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.IOExceptionvoid writeClassHeader(SourceFileWriter sourceFileWriter) throws java.io.IOException
java.io.IOExceptionvoid writeContent(SourceFileWriter sourceFileWriter) throws java.io.IOException
java.io.IOExceptionpublic int getModifiers()
public boolean hasAllModifiers(int mods)
public boolean hasAnyModifier(int mods)