Top Description Fields Constructors Methods
com.sun.codemodel

public final Class JEnumConstant

extends JExpressionImpl
implements JDeclaration, JAnnotatable, JDocCommentable
Class Inheritance
All Implemented Interfaces
com.sun.codemodel.JDocCommentable, com.sun.codemodel.JAnnotatable, com.sun.codemodel.JDeclaration
Imports
java.util.ArrayList, .List, .Collection, .Collections, java.lang.annotation.Annotation

Enum Constant. When used as an JExpression, this object represents a reference to the enum constant.
Author
Bhakti Mehta ([email protected])

Field Summary

Modifier and TypeField and Description
private List<JAnnotationUse>
annotations

Annotations on this variable.

private List<JExpression>
args

List of the constructor argument expressions.

private JDocComment
jdoc

javadoc comments, if any.

private final String
name

The constant.

private final JClass
type

The enum class.

Constructor Summary

AccessConstructor and Description
pack-priv

Method Summary

Modifier and TypeMethod and Description
public JAnnotationUse
annotate(JClass
The annotation class to annotate the field with
clazz
)

Implements com.sun.codemodel.JAnnotatable.annotate.

Adds an annotation to this variable.

public JAnnotationUse
annotate(Class<? extends Annotation>
The annotation class to annotate the field with
clazz
)

Implements com.sun.codemodel.JAnnotatable.annotate.

Adds an annotation to this variable.

public <W extends JAnnotationWriter<? extends Annotation>> W
annotate2(Class<W> clazz)

Implements com.sun.codemodel.JAnnotatable.annotate2.

Adds an annotation to this program element and returns a type-safe writer to fill in the values of such annotations.

public Collection<JAnnotationUse>
annotations()

Implements com.sun.codemodel.JAnnotatable.annotations.

Read-only live view of all annotations on this

public JEnumConstant
arg(JExpression
Argument to add to argument list
arg
)

Add an expression to this constructor's argument list

public void
public void
public String

Returns:

never null.
getName
()

Returns the name of this constant.

public JDocComment

Returns:

JDocComment containing javadocs for this constant.
javadoc
()

Implements com.sun.codemodel.JDocCommentable.javadoc.

Creates, if necessary, and returns the enum constant javadoc.

public boolean
removeAnnotation(JAnnotationUse annotation)

Implements com.sun.codemodel.JAnnotatable.removeAnnotation.

Removes annotation from this program element.

public String
toString()

Overrides java.lang.Object.toString.

Returns a string representation of the object.

pack-priv JClass
type()

Inherited from com.sun.codemodel.JExpressionImpl:
_instanceofbandborcandcomplementcomponentcordecrdiveqgtgteincrinvokeinvokeltlteminusminusmodmulnenotplusrefrefshlshrshrzxor

Field Detail

annotationsback to summary
private List<JAnnotationUse> annotations

Annotations on this variable. Lazily created.

argsback to summary
private List<JExpression> args

List of the constructor argument expressions. Lazily constructed.

jdocback to summary
private JDocComment jdoc

javadoc comments, if any.

nameback to summary
private final String name

The constant.

typeback to summary
private final JClass type

The enum class.

Constructor Detail

JEnumConstantback to summary
pack-priv JEnumConstant(JClass type, String name)

Method Detail

annotateback to summary
public JAnnotationUse annotate(JClass clazz)

Implements com.sun.codemodel.JAnnotatable.annotate.

Adds an annotation to this variable.

Parameters
clazz:JClass

The annotation class to annotate the field with

Annotations
@Override
annotateback to summary
public JAnnotationUse annotate(Class<? extends Annotation> clazz)

Implements com.sun.codemodel.JAnnotatable.annotate.

Adds an annotation to this variable.

Parameters
clazz:Class<? extends Annotation>

The annotation class to annotate the field with

Annotations
@Override
annotate2back to summary
public <W extends JAnnotationWriter<? extends Annotation>> W annotate2(Class<W> clazz)

Implements com.sun.codemodel.JAnnotatable.annotate2.

Doc from com.sun.codemodel.JAnnotatable.annotate2.

Adds an annotation to this program element and returns a type-safe writer to fill in the values of such annotations.

Annotations
@Override
annotationsback to summary
public Collection<JAnnotationUse> annotations()

Implements com.sun.codemodel.JAnnotatable.annotations.

Doc from com.sun.codemodel.JAnnotatable.annotations.

Read-only live view of all annotations on this

Annotations
@Override
argback to summary
public JEnumConstant arg(JExpression arg)

Add an expression to this constructor's argument list

Parameters
arg:JExpression

Argument to add to argument list

declareback to summary
public void declare(JFormatter f)

Implements com.sun.codemodel.JDeclaration.declare.

Annotations
@Override
generateback to summary
public void generate(JFormatter f)

Implements com.sun.codemodel.JGenerable.generate.

Annotations
@Override
getNameback to summary
public String getName()

Returns the name of this constant.

Returns:String

never null.

javadocback to summary
public JDocComment javadoc()

Implements com.sun.codemodel.JDocCommentable.javadoc.

Creates, if necessary, and returns the enum constant javadoc.

Returns:JDocComment

JDocComment containing javadocs for this constant.

Annotations
@Override
removeAnnotationback to summary
public boolean removeAnnotation(JAnnotationUse annotation)

Implements com.sun.codemodel.JAnnotatable.removeAnnotation.

Doc from com.sun.codemodel.JAnnotatable.removeAnnotation.

Removes annotation from this program element.

Annotations
@Override
toStringback to summary
public String toString()

Overrides java.lang.Object.toString.

Doc from java.lang.Object.toString.

Returns a string representation of the object. Satisfying this method's contract implies a non-null result must be returned.

Annotations
@Override
typeback to summary
pack-priv JClass type()