Interface CtEnum<T extends Enum<?>>

All Superinterfaces:
Cloneable, CtClass<T>, CtCodeElement, CtElement, CtFormalTypeDeclarer, CtModifiable, CtNamedElement, CtQueryable, CtSealable, 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<?>>
    • getPermittedTypes

      Set<CtTypeReference<?>> getPermittedTypes()
      Description copied from interface: CtSealable
      Returns the permitted types for this type.
      Specified by:
      getPermittedTypes in interface CtSealable
      Returns:
      an unmodifiable view of the permitted types.
    • setPermittedTypes

      CtEnum<T> setPermittedTypes(Collection<CtTypeReference<?>> permittedTypes)
      Description copied from interface: CtSealable
      Sets the permitted types for this type. Calling this method does not change the state of the ModifierKind.SEALED for this type. The previously permitted types will be removed.
      Specified by:
      setPermittedTypes in interface CtSealable
      Parameters:
      permittedTypes - the permitted types to set.
      Returns:
      this.
    • addPermittedType

      CtEnum<T> addPermittedType(CtTypeReference<?> type)
      Description copied from interface: CtSealable
      Adds a permitted type to this type. Calling this method does not change the state of the ModifierKind.SEALED for this type.
      Specified by:
      addPermittedType in interface CtSealable
      Parameters:
      type - the type to add as permitted type.
      Returns:
      this.
    • removePermittedType

      CtEnum<T> removePermittedType(CtTypeReference<?> type)
      Description copied from interface: CtSealable
      Adds a permitted type to this type. Calling this method does not change the state of the ModifierKind.SEALED for this type.
      Specified by:
      removePermittedType in interface CtSealable
      Parameters:
      type - the type to remove from this type's permitted types.
      Returns:
      this.