DependencyKind enum
The form of an injection point that a Dependency describes: one bean,
all beans of a type, a provider, a @Value, and so on.
The generator picks the kind from the parameter or field it reads, and
validateBeanGraph checks each kind in its own way (a provider is never
required, a @Lazy point never closes a cycle). You choose one yourself
only through the Dependency constructors of a hand-written
definition. The forms, as the generator sees them:
@Service()
class Checkout {
Checkout(
this.payments, // single
this.validators, // collection (List<Validator>)
this.byName, // map (Map<String, Exporter>)
this.audit, // provider (ObjectProvider<Audit>)
@Value(r'${shop.currency:EUR}') this.currency, // value
);
final Payments payments;
final List<Validator> validators;
final Map<String, Exporter> byName;
final ObjectProvider<Audit> audit;
final String currency;
}
Spring (Java): no public equivalent; Spring discovers the same kinds of
injection points by reflection (DependencyDescriptor):
Checkout(Payments payments, List<Validator> validators,
Map<String, Exporter> byName, ObjectProvider<Audit> audit,
@Value("${shop.currency:EUR}") String currency) { ... }
Values
- single → const DependencyKind
-
One bean (
T, orT?when it may be missing). - collection → const DependencyKind
-
All beans of a type (
List<T>orSet<T>). - map → const DependencyKind
-
All beans of a type by bean name (
Map<String, T>). - provider → const DependencyKind
-
A lazy
ObjectProvider<T>(orObjectFactory<T>, jakartaProvider<T>): nothing is resolved before it is used, so it is never required and never part of a cycle. - lazy → const DependencyKind
-
A
@Lazysingle bean: checked like single (present, unambiguous) but resolved on first use, so never part of a cycle. - value → const DependencyKind
-
A
@Valueexpression; a required one must have a value at startup. - resource → const DependencyKind
-
A
@Resourcefield or setter: the bean named Dependency.name, or with Dependency.fallbackToType a bean of the type when no bean has that name.
Properties
- hashCode → int
-
The hash code for this object.
no setterinherited
- index → int
-
A numeric identifier for the enumerated value.
no setterinherited
- name → String
-
Available on Enum, provided by the EnumName extension
The name of the enum value.no setter - 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
-
toString(
) → String -
A string representation of this object.
inherited
Operators
-
operator ==(
Object other) → bool -
The equality operator.
inherited
Constants
-
values
→ const List<
DependencyKind> - A constant List of the values in this enum, in order of their declaration.