EnumValue class abstract final

Represents a single value within an enum type, providing full reflective access to its metadata, declaration details, and runtime behavior.

This interface abstracts enum value inspection, including:

  • Declaring enum type access
  • Field-level metadata such as annotations, documentation, and modifiers
  • Source position within the enum
  • Nullability and value extraction

Key Features

  • Retrieve the declaring enum class
  • Inspect the enum field declaration (annotations, docs, modifiers)
  • Determine the positional index of the enum value
  • Reflectively read the enum value at runtime
  • Nullability checking

Implementation Notes

Concrete implementations typically wrap analyzer- or mirror-based metadata to unify enum reflection across build-time and runtime environments.

Inheritance

Constructors

EnumValue.declared(EnumDeclaration declaration, EnumFieldDeclaration field, [ProtectionDomain? pd])
Creates a reflective EnumValue from its declaration metadata.
factory

Properties

hashCode → int
The hash code for this object.
no setterinherited
runtimeType → Type
A representation of the runtime type of the object.
no setterinherited

Methods

checkAccess(String operation, DomainPermission permission) → void
Verifies access permissions before performing sensitive operations.
inherited
getAuthor() → Author?
Retrieves the Author annotation applied to this element, if present.
inherited
getDeclaration() → EnumDeclaration
Gets the type declaration metadata for the declaring enum.
getDeclaringClass<D>() → Class<D>
Gets the class that declares this enum value.
getFieldDeclaration() → EnumFieldDeclaration
Gets the field declaration metadata associated with this enum value.
getName() → String
Gets the declared name of the source.
getPosition() → int
The position of this enum value as declared in the enum class.
getProtectionDomain() → ProtectionDomain
Gets the protection domain governing access to this element.
inherited
getSignature() → String
Gets the executable signature as a string.
getValue() → dynamic
Gets the enum's concrete runtime value.
getVersion() → Version
Retrieves the version metadata associated with this declaration, if any.
inherited
isNullable() → bool
Returns true if the enum value's type is nullable.
noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
toString() → String
A string representation of this object.
inherited

Operators

operator ==(Object other) → bool
The equality operator.
inherited