Package org.jboss.jdeparser
Class ImplJAnonymousClassDef
- java.lang.Object
-
- org.jboss.jdeparser.AbstractJExpr
-
- org.jboss.jdeparser.AbstractJCall
-
- org.jboss.jdeparser.ImplJAnonymousClassDef
-
- All Implemented Interfaces:
AllowedStatementExpression
,JAnnotatable
,JAnonymousClassDef
,JCall
,JClassDef
,JClassDefSection
,JCommentable
,JDocCommentable
,JExpr
,JGenericDef
,JSimpleArgs
,Writable
- Direct Known Subclasses:
InnerJAnonymousClassDef
class ImplJAnonymousClassDef extends AbstractJCall implements JAnonymousClassDef
-
-
Constructor Summary
Constructors Constructor Description ImplJAnonymousClassDef(JType type)
-
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.JEnumConstant
_enum(java.lang.String name)
Add an enum constant.JClassDef
_extends(java.lang.Class<?> clazz)
Add anextends
type to this type.JClassDef
_extends(java.lang.String name)
Add anextends
type to this type.JClassDef
_extends(JType type)
Add anextends
type to this type.JClassDef
_implements(java.lang.Class<?>... classes)
Add one or moreimplements
type(s) to this type.JClassDef
_implements(java.lang.String... names)
Add one or moreimplements
type(s) to this type.JClassDef
_implements(JType... types)
Add one or moreimplements
type(s) to this type.JClassDef
_interface(int mods, java.lang.String name)
Add a nested interface to this type.JAnnotation
annotate(java.lang.Class<? extends java.lang.annotation.Annotation> type)
Add an annotation.JAnnotation
annotate(java.lang.String type)
Add an annotation.JAnnotation
annotate(JType type)
Add an annotation.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.JComment
blockComment()
Add a block comment.JMethodDef
constructor(int mods)
Add a constructor to this type.JComment
deprecated()
Mark this program element as deprecated.JDocComment
docComment()
Get or create the doc comment for this element.JType
erasedType()
Get the erased type corresponding to this type definition.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.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).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.JType
type()
JTypeParamDef
typeParam(java.lang.String name)
Define a type parameter.JTypeParamDef[]
typeParams()
Get all the type parameters defined at the time of invocation.void
write(SourceFileWriter writer)
-
Methods inherited from class org.jboss.jdeparser.AbstractJCall
arg, arguments, diamond, typeArg, typeArg, typeArg, typeArguments, writeTypeArgs
-
Methods inherited from class org.jboss.jdeparser.AbstractJExpr
_instanceof, _instanceof, _instanceof, _new, _new, _new, _newAnon, _newAnon, _newAnon, $v, and, band, bor, bxor, call, cast, cast, cast, comp, cond, div, eq, field, ge, gt, idx, idx, le, length, lshr, lt, minus, mod, ne, neg, not, of, or, paren, plus, prec, shl, shr, times
-
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.JCall
arg, arguments, diamond, typeArg, typeArg, typeArg, typeArguments
-
Methods inherited from interface org.jboss.jdeparser.JExpr
_instanceof, _instanceof, _instanceof, _new, _new, _new, _newAnon, _newAnon, _newAnon, $v, and, band, bor, bxor, call, cast, cast, cast, comp, cond, div, eq, field, ge, gt, idx, idx, le, length, lshr, lt, minus, mod, ne, neg, not, or, paren, plus, shl, shr, times
-
-
-
-
Field Detail
-
classDef
private final AnonymousJClassDef classDef
-
type
private final JType type
-
-
Constructor Detail
-
ImplJAnonymousClassDef
ImplJAnonymousClassDef(JType type)
-
-
Method Detail
-
type
public JType type()
-
write
public void write(SourceFileWriter writer) throws java.io.IOException
- Specified by:
write
in interfaceWritable
- Overrides:
write
in classAbstractJCall
- Throws:
java.io.IOException
-
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
-
_extends
public JClassDef _extends(java.lang.String name)
Description copied from interface:JClassDef
Add anextends
type to this type.
-
_extends
public JClassDef _extends(JType type)
Description copied from interface:JClassDef
Add anextends
type to this type.
-
_extends
public JClassDef _extends(java.lang.Class<?> clazz)
Description copied from interface:JClassDef
Add anextends
type to this type.
-
_implements
public JClassDef _implements(java.lang.String... names)
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
public JClassDef _implements(JType... types)
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
public JClassDef _implements(java.lang.Class<?>... classes)
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
-
erasedType
public JType erasedType()
Description copied from interface:JClassDef
Get the erased type corresponding to this type definition.- Specified by:
erasedType
in interfaceJClassDef
- Returns:
- the erased type
-
blankLine
public JClassDef 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
-
genericType
public JType 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
public JTypeParamDef typeParam(java.lang.String name)
Description copied from interface:JGenericDef
Define a type parameter.- Specified by:
typeParam
in interfaceJGenericDef
- Parameters:
name
- the type parameter name- Returns:
- the type parameter 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
-
_enum
public JEnumConstant _enum(java.lang.String name)
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(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
-
typeParams
public JTypeParamDef[] typeParams()
Description copied from interface:JGenericDef
Get all the type parameters defined at the time of invocation.- Specified by:
typeParams
in interfaceJGenericDef
- Returns:
- the type parameters
-
annotate
public JAnnotation annotate(java.lang.String type)
Description copied from interface:JAnnotatable
Add an annotation.- Specified by:
annotate
in interfaceJAnnotatable
- Parameters:
type
- the type of the annotation to add- Returns:
- the new annotation
-
annotate
public JAnnotation annotate(JType type)
Description copied from interface:JAnnotatable
Add an annotation.- Specified by:
annotate
in interfaceJAnnotatable
- Parameters:
type
- the type of the annotation to add- Returns:
- the new annotation
-
annotate
public JAnnotation annotate(java.lang.Class<? extends java.lang.annotation.Annotation> type)
Description copied from interface:JAnnotatable
Add an annotation.- Specified by:
annotate
in interfaceJAnnotatable
- Parameters:
type
- the type of the annotation to add- Returns:
- the new annotation
-
docComment
public JDocComment docComment()
Description copied from interface:JDocCommentable
Get or create the doc comment for this element.- Specified by:
docComment
in interfaceJDocCommentable
- Returns:
- the doc comment body
-
deprecated
public JComment deprecated()
Description copied from interface:JDocCommentable
Mark this program element as deprecated.- Specified by:
deprecated
in interfaceJDocCommentable
- Returns:
- the deprecation tag body
-
lineComment
public JComment lineComment()
Description copied from interface:JCommentable
Add a line comment.- Specified by:
lineComment
in interfaceJCommentable
- Overrides:
lineComment
in classAbstractJCall
- Returns:
- the line comment body
-
blockComment
public JComment blockComment()
Description copied from interface:JCommentable
Add a block comment.- Specified by:
blockComment
in interfaceJCommentable
- Overrides:
blockComment
in classAbstractJCall
- Returns:
- the block comment body
-
_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
-
-