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 JDocCommentjavadoc comments, if any.private final StringThe constant.private final JDefinedClassThe 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 listvoidvoidgetName()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
-
javadoc
Creates, if necessary, and returns the enum constant javadoc.- Specified by:
javadocin interfaceJDocCommentable- Returns:
- JDocComment containing javadocs for this constant.
-
annotate
Adds an annotation to this variable.- Specified by:
annotatein interfaceJAnnotatable- Parameters:
clazz- The annotation class to annotate the field with
-
annotate
Adds an annotation to this variable.- Specified by:
annotatein interfaceJAnnotatable- Parameters:
clazz- The annotation class to annotate the field with
-
annotate2
Description copied from interface:JAnnotatableAdds an annotation to this program element and returns a type-safe writer to fill in the values of such annotations.- Specified by:
annotate2in interfaceJAnnotatable
-
annotations
- Specified by:
annotationsin interfaceJAnnotatable- Returns:
- Can be empty but never null.
-
declare
- Specified by:
declarein interfaceJDeclaration
-
generate
- Specified by:
generatein interfaceJGenerable
-