Package com.sun.codemodel
Class JEnumConstant
java.lang.Object
com.sun.codemodel.JExpressionImpl
com.sun.codemodel.JEnumConstant
- All Implemented Interfaces:
JAnnotatable
,JDeclaration
,JDocCommentable
,JExpression
,JGenerable
public final class JEnumConstant
extends JExpressionImpl
implements JDeclaration, JAnnotatable, JDocCommentable
Enum Constant.
When used as an
JExpression
, this object represents a reference to the enum constant.-
Field Summary
FieldsModifier and TypeFieldDescriptionprivate List
<JAnnotationUse> Annotations on this variable.private List
<JExpression> List of the constructor argument expressions.private JDocComment
javadoc comments, if any.private final String
The constant.private final JDefinedClass
The enum class. -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionAdds an annotation to this variable.annotate
(Class<? extends Annotation> clazz) Adds an annotation to this variable.<W extends JAnnotationWriter>
WAdds an annotation to this program element and returns a type-safe writer to fill in the values of such annotations.arg
(JExpression arg) Add an expression to this constructor's argument listvoid
void
getName()
Returns the name of this constant.javadoc()
Creates, if necessary, and returns the enum constant javadoc.
-
Field Details
-
name
The constant. -
type
The enum class. -
jdoc
javadoc comments, if any. -
annotations
Annotations on this variable. Lazily created. -
args
List of the constructor argument expressions. Lazily constructed.
-
-
Constructor Details
-
JEnumConstant
JEnumConstant(JDefinedClass type, String name)
-
-
Method Details
-
arg
Add an expression to this constructor's argument list- Parameters:
arg
- Argument to add to argument list
-
getName
Returns the name of this constant.- Returns:
- never null.
-
javadoc
Creates, if necessary, and returns the enum constant javadoc.- Specified by:
javadoc
in interfaceJDocCommentable
- Returns:
- JDocComment containing javadocs for this constant.
-
annotate
Adds an annotation to this variable.- Specified by:
annotate
in interfaceJAnnotatable
- Parameters:
clazz
- The annotation class to annotate the field with
-
annotate
Adds an annotation to this variable.- Specified by:
annotate
in interfaceJAnnotatable
- Parameters:
clazz
- The annotation class to annotate the field with
-
annotate2
Description copied from interface:JAnnotatable
Adds an annotation to this program element and returns a type-safe writer to fill in the values of such annotations.- Specified by:
annotate2
in interfaceJAnnotatable
-
annotations
- Specified by:
annotations
in interfaceJAnnotatable
- Returns:
- Can be empty but never null.
-
declare
- Specified by:
declare
in interfaceJDeclaration
-
generate
- Specified by:
generate
in interfaceJGenerable
-