Interface CtEnum<T extends Enum<?>>

All Superinterfaces:
Cloneable, CtClass<T>, CtCodeElement, CtElement, CtFormalTypeDeclarer, CtModifiable, CtNamedElement, CtQueryable, CtShadowable, CtStatement, CtType<T>, CtTypeInformation, CtTypeMember, CtVisitable, FactoryAccessor, Serializable, SourcePositionHolder
All Known Implementing Classes:
CtEnumImpl

public interface CtEnum<T extends Enum<?>> extends CtClass<T>
This element represents an enumeration declaration. Example:
    enum Boolean { TRUE, FALSE }
 
  • Method Details

    • addEnumValue

      <C extends CtEnum<T>> C addEnumValue(CtEnumValue<?> enumValue)
      Adds an enum value.
      Parameters:
      enumValue - An enum value.
      Returns:
      true if this element changed as a result of the call
    • removeEnumValue

      boolean removeEnumValue(CtEnumValue<?> enumValue)
      Removes en enum value.
      Parameters:
      enumValue - An enum value.
      Returns:
      true if this element changed as a result of the call
    • getEnumValue

      CtEnumValue<?> getEnumValue(String name)
      Gets an enum value by its name.
      Parameters:
      name - Name of the enum value.
      Returns:
      An enum value.
    • getEnumValues

      List<CtEnumValue<?>> getEnumValues()
      Gets all enum values of the enumeration.
      Returns:
      All enum values.
    • setEnumValues

      <C extends CtEnum<T>> C setEnumValues(List<CtEnumValue<?>> enumValues)
      Sets all enum values of the enum.
    • clone

      CtEnum<T> clone()
      Description copied from interface: CtElement
      Clone the element which calls this method in a new object. Note that that references are kept as is, and thus, so if you clone whole classes or methods, some parts of the cloned element (eg executable references) may still point to the initial element. In this case, consider using methods Refactoring.copyType(CtType) and Refactoring.copyMethod(CtMethod) instead which does additional work beyond cloning.
      Specified by:
      clone in interface CtClass<T extends Enum<?>>
      Specified by:
      clone in interface CtCodeElement
      Specified by:
      clone in interface CtElement
      Specified by:
      clone in interface CtNamedElement
      Specified by:
      clone in interface CtStatement
      Specified by:
      clone in interface CtType<T extends Enum<?>>
    • setFormalCtTypeParameters

      <T extends CtFormalTypeDeclarer> T setFormalCtTypeParameters(List<CtTypeParameter> formalTypeParameters)
      Description copied from interface: CtFormalTypeDeclarer
      Sets the type parameters of this generic element.
      Specified by:
      setFormalCtTypeParameters in interface CtFormalTypeDeclarer
    • setSuperclass

      <C extends CtType<T>> C setSuperclass(CtTypeReference<?> superClass)
      Description copied from interface: CtType
      Sets the superclass type.
      Specified by:
      setSuperclass in interface CtType<T extends Enum<?>>