Package org.jboss.jdeparser
Class AbstractJClassDef
java.lang.Object
org.jboss.jdeparser.BasicJCommentable
org.jboss.jdeparser.AbstractJDocCommentable
org.jboss.jdeparser.BasicJAnnotatable
org.jboss.jdeparser.AbstractJGeneric
org.jboss.jdeparser.AbstractJClassDef
- All Implemented Interfaces:
ClassContent
,ClassFileContent
,JAnnotatable
,JClassDef
,JClassDefSection
,JCommentable
,JDocCommentable
,JGenericDef
,Sectionable
,Writable
- Direct Known Subclasses:
AnnotationJClassDef
,AnonymousJClassDef
,EnumConstantJClassDef
,EnumJClassDef
,InterfaceJClassDef
,PlainJClassDef
abstract class AbstractJClassDef
extends AbstractJGeneric
implements JClassDef, ClassFileContent, ClassContent, Sectionable
-
Field Summary
FieldsModifier and TypeFieldDescriptionprivate JType
private final ImplJSourceFile
private final ArrayList<ClassContent>
private final AbstractJClassDef
private JType
private JType
private final int
private final String
-
Constructor Summary
ConstructorsConstructorDescriptionAbstractJClassDef
(int mods, String name) AbstractJClassDef
(int mods, AbstractJClassDef enclosingClass, String name) AbstractJClassDef
(int mods, ImplJSourceFile classFile, String name) -
Method Summary
Modifier and TypeMethodDescriptionfinal JClassDef
Add a nested class to this type._class
(ArrayList<ClassContent> content, int mods, String name) final JClassDef
Add a nested enum to this type.Add an enum constant._enum
(ArrayList<ClassContent> content, int mods, String name) Add anextends
type to this type.Add anextends
type to this type.Add anextends
type to this type._implements
(Class<?>... classes) Add one or moreimplements
type(s) to this type._implements
(String... names) Add one or moreimplements
type(s) to this type._implements
(JType... types) Add one or moreimplements
type(s) to this type.final JClassDef
_interface
(int mods, String name) Add a nested interface to this type._interface
(ArrayList<ClassContent> content, int mods, String name) (package private) <C extends ClassContent>
Cadd
(C item) (package private) <C extends ClassContent>
Cadd
(ArrayList<ClassContent> content, C item) final JClassDef
annotationInterface
(int mods, String name) Add a nested annotation interface to this type.annotationInterface
(ArrayList<ClassContent> content, int mods, String name) Add a blank line at this point of the type.Add a block comment.final JMethodDef
constructor
(int mods) Add a constructor to this type.constructor
(ArrayList<ClassContent> content, int mods) (package private) abstract Tokens.$KW
Get the erased type corresponding to this type definition.final JVarDeclaration
Add a field to this type.final JVarDeclaration
Add a field to this type.final JVarDeclaration
Add a field to this type.final JVarDeclaration
Add a field to this type.final JVarDeclaration
Add a field to this type.final JVarDeclaration
Add a field to this type.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
(package private) Iterable<ClassContent>
(package private) AbstractJClassDef
(package private) JType
(package private) FormatPreferences.Indentation
int
(package private) int
getMods()
(package private) String
getName()
boolean
hasAllModifiers
(int mods) boolean
hasAnyModifier
(int mods) (package private) boolean
final JBlock
init()
Add a "raw" initialization block to this type definition.init
(ArrayList<ClassContent> content) Add a line comment.final JMethodDef
Add a method to this type.final JMethodDef
Add a method to this type.final JMethodDef
Add a method to this type.method
(ArrayList<ClassContent> content, int mods, JType returnType, String name) (package private) boolean
methodCanHaveBody
(int mods) section()
Create a section at this point, into which additional items may be added.final JBlock
Add a static initialization block to this type definition.staticInit
(ArrayList<ClassContent> content) (package private) boolean
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) Methods inherited from class org.jboss.jdeparser.AbstractJGeneric
typeParams, typeParamsToArgs, writeTypeParams
Methods inherited from class org.jboss.jdeparser.BasicJAnnotatable
annotate, annotate, annotate, writeAnnotations
Methods inherited from class org.jboss.jdeparser.AbstractJDocCommentable
deprecated, docComment, writeDocComments
Methods inherited from class org.jboss.jdeparser.BasicJCommentable
writeComments
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
Methods inherited from interface org.jboss.jdeparser.JAnnotatable
annotate, annotate, annotate
Methods inherited from interface org.jboss.jdeparser.JDocCommentable
deprecated, docComment
Methods inherited from interface org.jboss.jdeparser.JGenericDef
typeParams
-
Field Details
-
mods
private final int mods -
name
-
enclosingClass
-
classFile
-
-
_extends
-
_implements
-
erased
-
generic
-
-
Constructor Details
-
AbstractJClassDef
AbstractJClassDef(int mods, String name) -
AbstractJClassDef
AbstractJClassDef(int mods, AbstractJClassDef enclosingClass, String name) -
AbstractJClassDef
AbstractJClassDef(int mods, ImplJSourceFile classFile, String name)
-
-
Method Details
-
getEnclosingClass
AbstractJClassDef getEnclosingClass() -
getClassFile
ImplJSourceFile getClassFile() -
getMods
int getMods() -
getName
String getName() -
add
-
add
-
lineComment
Description copied from interface:JCommentable
Add a line comment.- Specified by:
lineComment
in interfaceJCommentable
- Overrides:
lineComment
in classBasicJCommentable
- Returns:
- the line comment body
-
blockComment
Description copied from interface:JCommentable
Add a block comment.- Specified by:
blockComment
in interfaceJCommentable
- Overrides:
blockComment
in classBasicJCommentable
- Returns:
- the block comment body
-
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
-
_extends
Description copied from interface:JClassDef
Add anextends
type to this type. -
_extends
Description copied from interface:JClassDef
Add anextends
type to this type. -
_extends
Description copied from interface:JClassDef
Add anextends
type to this type. -
_implements
Description copied from interface:JClassDef
Add one or moreimplements
type(s) to this type.- Specified by:
_implements
in interfaceJClassDef
- Parameters:
names
- the type name- Returns:
- this type definition
-
_implements
Description copied from interface:JClassDef
Add one or moreimplements
type(s) to this type.- Specified by:
_implements
in interfaceJClassDef
- Parameters:
types
- the type- Returns:
- this type definition
-
_implements
Description copied from interface:JClassDef
Add one or moreimplements
type(s) to this type.- Specified by:
_implements
in interfaceJClassDef
- Parameters:
classes
- the type- Returns:
- this type definition
-
blankLine
Description copied from interface:JClassDef
Add a blank line at this point of the type.- Specified by:
blankLine
in interfaceJClassDef
- Specified by:
blankLine
in interfaceJClassDefSection
- Returns:
- this type definition
-
erasedType
Description copied from interface:JClassDef
Get the erased type corresponding to this type definition.- Specified by:
erasedType
in interfaceJClassDef
- Returns:
- the erased type
-
genericType
Description copied from interface:JClassDef
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).- Specified by:
genericType
in interfaceJClassDef
- Returns:
- the generic type
-
typeParam
Description copied from interface:JGenericDef
Define a type parameter.- Specified by:
typeParam
in interfaceJGenericDef
- Overrides:
typeParam
in classAbstractJGeneric
- Parameters:
name
- the type parameter name- Returns:
- the type parameter definition
-
init
Description copied from interface:JClassDefSection
Add a "raw" initialization block to this type definition.- Specified by:
init
in interfaceJClassDefSection
- Returns:
- the initialization block
-
init
- Specified by:
init
in interfaceSectionable
-
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
-
staticInit
- Specified by:
staticInit
in interfaceSectionable
-
_enum
Description copied from interface:JClassDef
Add an enum constant. If the class being defined is not an enum, an exception is thrown. -
field
public JVarDeclaration field(ArrayList<ClassContent> content, int mods, JType type, String name, JExpr init) - Specified by:
field
in interfaceSectionable
-
field
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
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
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
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
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
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
- Specified by:
method
in interfaceSectionable
-
method
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
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
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
-
methodCanHaveBody
boolean methodCanHaveBody(int mods) -
hasInterfaceStyleExtends
boolean hasInterfaceStyleExtends() -
supportsCompactInitOnly
boolean supportsCompactInitOnly() -
constructor
- Specified by:
constructor
in interfaceSectionable
-
constructor
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
- Specified by:
_class
in interfaceSectionable
-
_enum
- Specified by:
_enum
in interfaceSectionable
-
_interface
- Specified by:
_interface
in interfaceSectionable
-
annotationInterface
- Specified by:
annotationInterface
in interfaceSectionable
-
_class
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
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
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
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
-
getContent
Iterable<ClassContent> getContent() -
getExtends
JType getExtends() -
getImplements
-
designation
-
getMemberIndentation
FormatPreferences.Indentation getMemberIndentation() -
write
- Specified by:
write
in interfaceWritable
- Throws:
IOException
-
writeContentBlock
- Throws:
IOException
-
writeClassHeader
- Throws:
IOException
-
writeContent
- Throws:
IOException
-
getModifiers
public int getModifiers() -
hasAllModifiers
public boolean hasAllModifiers(int mods) -
hasAnyModifier
public boolean hasAnyModifier(int mods)
-