AnnotatedScopeMetadataResolver class final

A Jetleaf-provided implementation of ScopeMetadataResolver that determines scope metadata based on the presence of the @Scope annotation.

If a class is annotated with @Scope, its declared value will be used as the lifecycle scope (e.g., "singleton", "prototype", "request"). If no annotation is found, the default scope "singleton" is applied.

Key Features:

  • Honors custom scope definitions declared with @Scope.
  • Provides sensible defaults (singleton scope).
  • Lightweight and efficient — only inspects annotations.

Example:

@Scope('prototype')
class PrototypeService {}

void main() {
  final resolver = AnnotatedScopeMetadataResolver();

  final scope1 = resolver.resolve(Class<PrototypeService>());
  print(scope1); // "prototype"

  final scope2 = resolver.resolve(Class<Object>());
  print(scope2); // "singleton"
}

This resolver is the default choice in Jetleaf when using annotation-driven configuration.

Implemented types

Constructors

AnnotatedScopeMetadataResolver()
A Jetleaf-provided implementation of ScopeMetadataResolver that determines scope metadata based on the presence of the @Scope annotation.
const

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

noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
resolve(Class classType) String
Resolves the scope metadata for the given classType.
override
resolveScopeDescriptor(Class classType) → ScopeDesign
Resolves the scope descriptor for the given classType.
override
toString() String
A string representation of this object.
inherited

Operators

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