class ImplJAnonymousClassDef extends AbstractJCall implements JAnonymousClassDef
Modifier and Type | Field and Description |
---|---|
private AnonymousJClassDef |
classDef |
private JType |
type |
Constructor and Description |
---|
ImplJAnonymousClassDef(JType type) |
Modifier and Type | Method and 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 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(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(JType type)
Add an annotation.
|
JAnnotation |
annotate(java.lang.String 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,
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).
|
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,
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.
|
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) |
arg, arguments, diamond, typeArg, typeArg, typeArg, typeArguments, writeTypeArgs
_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
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
arg, arguments, diamond, typeArg, typeArg, typeArg, typeArguments
_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
private final AnonymousJClassDef classDef
private final JType type
ImplJAnonymousClassDef(JType type)
public JType type()
public void write(SourceFileWriter writer) throws java.io.IOException
write
in interface Writable
write
in class AbstractJCall
java.io.IOException
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 JType erasedType()
JClassDef
erasedType
in interface JClassDef
public JClassDef blankLine()
JClassDef
blankLine
in interface JClassDef
blankLine
in interface JClassDefSection
public JType genericType()
JClassDef
genericType
in interface JClassDef
public JTypeParamDef typeParam(java.lang.String name)
JGenericDef
typeParam
in interface JGenericDef
name
- the type parameter namepublic JBlock init()
JClassDefSection
init
in interface JClassDefSection
public JBlock staticInit()
JClassDefSection
staticInit
in interface JClassDefSection
public JEnumConstant _enum(java.lang.String name)
JClassDef
public JVarDeclaration field(int mods, JType type, java.lang.String name)
JClassDefSection
field
in interface JClassDefSection
mods
- the modifierstype
- the field typename
- the field namepublic 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 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 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 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 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(int mods, JType returnType, java.lang.String name)
JClassDefSection
method
in interface JClassDefSection
mods
- the modifiersreturnType
- the method return typename
- the method namepublic 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 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 namepublic JMethodDef constructor(int mods)
JClassDefSection
constructor
in interface JClassDefSection
mods
- the modifierspublic JTypeParamDef[] typeParams()
JGenericDef
typeParams
in interface JGenericDef
public JAnnotation annotate(java.lang.String type)
JAnnotatable
annotate
in interface JAnnotatable
type
- the type of the annotation to addpublic JAnnotation annotate(JType type)
JAnnotatable
annotate
in interface JAnnotatable
type
- the type of the annotation to addpublic JAnnotation annotate(java.lang.Class<? extends java.lang.annotation.Annotation> type)
JAnnotatable
annotate
in interface JAnnotatable
type
- the type of the annotation to addpublic JDocComment docComment()
JDocCommentable
docComment
in interface JDocCommentable
public JComment deprecated()
JDocCommentable
deprecated
in interface JDocCommentable
public JComment lineComment()
JCommentable
lineComment
in interface JCommentable
lineComment
in class AbstractJCall
public JComment blockComment()
JCommentable
blockComment
in interface JCommentable
blockComment
in class AbstractJCall
public JClassDef _class(int mods, java.lang.String name)
JClassDefSection
_class
in interface JClassDefSection
mods
- the class modifiersname
- the class namepublic JClassDef _enum(int mods, java.lang.String name)
JClassDefSection
_enum
in interface JClassDefSection
mods
- the enum modifiersname
- the enum namepublic JClassDef _interface(int mods, java.lang.String name)
JClassDefSection
_interface
in interface JClassDefSection
mods
- the interface modifiersname
- the interface namepublic JClassDef annotationInterface(int mods, java.lang.String name)
JClassDefSection
annotationInterface
in interface JClassDefSection
mods
- the annotation interface modifiersname
- the annotation interface name