public final class JEnumConstant extends JExpressionImpl implements JDeclaration, JAnnotatable, JDocCommentable
JExpression, this object represents a reference to the enum constant.| Modifier and Type | Field and Description |
|---|---|
private java.util.List<JAnnotationUse> |
annotations
Annotations on this variable.
|
private java.util.List<JExpression> |
args
List of the constructor argument expressions.
|
private JDocComment |
jdoc
javadoc comments, if any.
|
private java.lang.String |
name
The constant.
|
private JDefinedClass |
type
The enum class.
|
| Constructor and Description |
|---|
JEnumConstant(JDefinedClass type,
java.lang.String name) |
| Modifier and Type | Method and Description |
|---|---|
JAnnotationUse |
annotate(java.lang.Class<? extends java.lang.annotation.Annotation> clazz)
Adds an annotation to this variable.
|
JAnnotationUse |
annotate(JClass clazz)
Adds an annotation to this variable.
|
<W extends JAnnotationWriter> |
annotate2(java.lang.Class<W> clazz)
Adds an annotation to this program element
and returns a type-safe writer to fill in the values of such annotations.
|
java.util.Collection<JAnnotationUse> |
annotations()
|
JEnumConstant |
arg(JExpression arg)
Add an expression to this constructor's argument list
|
void |
declare(JFormatter f) |
void |
generate(JFormatter f) |
java.lang.String |
getName()
Returns the name of this constant.
|
JDocComment |
javadoc()
Creates, if necessary, and returns the enum constant javadoc.
|
private final java.lang.String name
private final JDefinedClass type
private JDocComment jdoc
private java.util.List<JAnnotationUse> annotations
private java.util.List<JExpression> args
JEnumConstant(JDefinedClass type, java.lang.String name)
public JEnumConstant arg(JExpression arg)
arg - Argument to add to argument listpublic java.lang.String getName()
public JDocComment javadoc()
javadoc in interface JDocCommentablepublic JAnnotationUse annotate(JClass clazz)
annotate in interface JAnnotatableclazz - The annotation class to annotate the field withpublic JAnnotationUse annotate(java.lang.Class<? extends java.lang.annotation.Annotation> clazz)
annotate in interface JAnnotatableclazz - The annotation class to annotate the field withpublic <W extends JAnnotationWriter> W annotate2(java.lang.Class<W> clazz)
JAnnotatableannotate2 in interface JAnnotatablepublic java.util.Collection<JAnnotationUse> annotations()
annotations in interface JAnnotatablepublic void declare(JFormatter f)
declare in interface JDeclarationpublic void generate(JFormatter f)
generate in interface JGenerable