Class JEnum

  • All Implemented Interfaces:
    JAnnotatedElement

    public final class JEnum
    extends JClass
    Describes the definition of a enum type class.
    Version:
    $Revision: 8130 $ $Date: 2006-04-25 16:09:10 -0600 (Tue, 25 Apr 2006) $
    Author:
    Andrew Fawcett
    • Constructor Detail

      • JEnum

        public JEnum​(java.lang.String name)
        Construct JEnum with given name.
        Parameters:
        name - The name for this JEnum.
    • Method Detail

      • addConstructor

        public void addConstructor​(JConstructor constructor)
        Override to only allow private constructors.
        Overrides:
        addConstructor in class AbstractJClass
        Parameters:
        constructor - The constructor that should be added.
      • addEnumConstant

        public void addEnumConstant​(JEnumConstant jEnumConstant)
        Adds the given JEnumConstant to this JEnum.
        Parameters:
        jEnumConstant - The constant to add.
      • getEnumConstant

        public JEnumConstant getEnumConstant​(java.lang.String name)
        Returns the member with the given name, or null if no member was found with the given name.
        Parameters:
        name - The name of the member to return.
        Returns:
        The member with the given name, or null if no member was found with the given name.
      • getEnumConstants

        public JEnumConstant[] getEnumConstants()
        Returns an array of all the JEnumConstant of this JEnum.
        Returns:
        An array of all the JEnumConstant of this JEnum.
      • getEnumConstantCount

        public int getEnumConstantCount()
        Returns the number of enum constants.
        Returns:
        The number of enum constants.
      • print

        public void print​(JSourceWriter jsw,
                          boolean classOnly)
        Prints the source code for this JClass to the given JSourceWriter.
        Overrides:
        print in class JClass
        Parameters:
        jsw - The JSourceWriter to print to. Must not be null.
        classOnly - If true, the file header, package declaration, and imports are not printed.
        See Also:
        SourceGenerator.setJClassPrinterType(String)