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.
Author:
Bhakti Mehta (Bhakti.Mehta@sun.com)
  • Method Details

    • arg

      public JEnumConstant arg(JExpression arg)
      Add an expression to this constructor's argument list
      Parameters:
      arg - Argument to add to argument list
    • getName

      public String getName()
      Returns the name of this constant.
      Returns:
      never null.
    • toString

      public String toString()
      Overrides:
      toString in class Object
    • javadoc

      public JDocComment javadoc()
      Creates, if necessary, and returns the enum constant javadoc.
      Specified by:
      javadoc in interface JDocCommentable
      Returns:
      JDocComment containing javadocs for this constant.
    • annotate

      public JAnnotationUse annotate(JClass clazz)
      Adds an annotation to this variable.
      Specified by:
      annotate in interface JAnnotatable
      Parameters:
      clazz - The annotation class to annotate the field with
    • annotate

      public JAnnotationUse annotate(Class<? extends Annotation> clazz)
      Adds an annotation to this variable.
      Specified by:
      annotate in interface JAnnotatable
      Parameters:
      clazz - The annotation class to annotate the field with
    • annotate2

      public <W extends JAnnotationWriter<? extends Annotation>> W annotate2(Class<W> clazz)
      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 interface JAnnotatable
    • removeAnnotation

      public boolean removeAnnotation(JAnnotationUse annotation)
      Description copied from interface: JAnnotatable
      Removes annotation from this program element.
      Specified by:
      removeAnnotation in interface JAnnotatable
      Parameters:
      annotation - The annotation to be removed from the program element
    • annotations

      public Collection<JAnnotationUse> annotations()
      Description copied from interface: JAnnotatable
      Read-only live view of all annotations on this
      Specified by:
      annotations in interface JAnnotatable
      Returns:
      Can be empty but never null.
    • declare

      public void declare(JFormatter f)
      Specified by:
      declare in interface JDeclaration
    • generate

      public void generate(JFormatter f)
      Specified by:
      generate in interface JGenerable