Package com.zetaplugins.zetacore.di
Interface InstanceResolver
- Functional Interface:
- This is a functional interface and can therefore be used as the assignment target for a lambda expression or method reference.
Supplies instances for types the
ServiceRegistry cannot create on its own.
Resolvers are asked before the registry creates a new instance. The first non-null result is stored in the registry as a singleton for the requested type.
registry.addResolver(type -> type == Clock.class ? Clock.systemUTC() : null);
-
Method Summary
-
Method Details
-
resolve
Resolves an instance for the given type.- Parameters:
type- The requested type.- Returns:
- An instance assignable to the type, or null if this resolver does not handle it.
-