Interface EnumElement

All Superinterfaces:
AnnotatedElement, AnnotationMetadata, AnnotationMetadataDelegate, AnnotationMetadataProvider, AnnotationSource, ClassElement, Described, Element, MutableAnnotationMetadataDelegate<Element>, Named, TypedElement
All Known Implementing Classes:
PythonEnumElement, TypeAnnotatedEnumElement

public interface EnumElement extends ClassElement
Models an enum type.
Since:
1.0
Author:
graemerocher
  • Method Details

    • values

      List<String> values()
      The values that make up this enum.
      Returns:
      The values
    • elements

      default List<EnumConstantElement> elements()
      The enum constant elements that make up this enum.
      Returns:
      The enum constant elements
      Since:
      3.6.0
    • getEnumValueOfMethod

      default Optional<MethodElement> getEnumValueOfMethod()
      Returns the static method used to resolve an enum constant by name.

      Java enums use the standard Enum.valueOf(Class, String) path and therefore return an empty optional. Language implementations can expose their compiler-modelled lookup method so generated introspections can resolve constants without reflection.

      Returns:
      The enum constant lookup method, if one is available
      Since:
      5.2.0