# Annotation class abstract

Provides reflective access to annotations applied to declarations.

This interface abstracts annotation metadata access, allowing inspection of:

- Annotation types and signatures
- Field values (both user-provided and defaults)
- Protection domains
- Actual annotation instances

{@template annotation_interface_features}

## Key Features

- Type-safe field value access
- Distinction between default and user-provided values
- Protection domain awareness
- Full metadata inspection
- Instance retrieval when available

## Implementation Notes

Concrete implementations typically wrap platform-specific reflection objects while providing this uniform interface.

## Example Usage

    // Get annotation from a reflected method
    final annotation = method.getAnnotation<JsonSerializable>();

    // Inspect field values
    final explicitNulls = annotation?.getFieldValueAs<bool>('explicitToNull');
    final fieldRename = annotation?.getFieldValue('fieldRename');

    // Check value sources
    if (annotation?.hasUserProvidedValue('constructor')) {
      print('Custom constructor specified');
    }

    // Get all configured values
    final allValues = annotation?.getAllFieldValues();

{@endtemplate}

Inheritance
  - Object
  - PermissionManager
  - Annotation
Implemented types
  - FieldAccess

## Constructors

Annotation.new()

## Properties

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

## Methods

checkAccess(String operation, DomainPermission permission) → void
  Verifies access permissions before performing sensitive operations.
  inherited
getAllFieldValues() → Map<String, dynamic>
  Gets all field values (both user-provided and defaults).
getClass() → Class
  Gets the class metadata of the annotation type.
getDefaultValue(String fieldName) → dynamic
  Gets the default value of a field.
getField(String name) → Field?
  Gets a field by its name.
  inherited
getFieldNames() → List<String>
  Gets all field names declared on this annotation.
getFields() → List<Field>
  Gets all fields declared in this class.
  inherited
getFieldValue(String fieldName) → dynamic
  Gets the value of a field by name.
getFieldValueAs<T>(String fieldName) → T?
  Gets a field value with type conversion.
getInstance<Instance>() → Instance
  Attempts to retrieve the actual annotation instance.
getProtectionDomain() → ProtectionDomain
  Gets the protection domain governing access to this element.
  inherited
getSignature() → String
  Gets the annotation's signature string.
getType() → Type
  Gets the runtime type of the annotation.
getUserProvidedValue(String fieldName) → dynamic
  Gets the user-provided value of a field.
getUserProvidedValues() → Map<String, dynamic>
  Gets all user-provided values as a map.
hasDefaultValue(String fieldName) → bool
  Checks if a field has a default value.
hasField(String fieldName) → bool
  Checks if a field exists on this annotation.
hasUserProvidedValue(String fieldName) → bool
  Checks if a field has a user-provided value.
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

## Static Methods

declared(AnnotationDeclaration declaration, ProtectionDomain domain) → Annotation
  Creates an Annotation instance from reflection metadata.