Class DefaultOptionResolver
java.lang.Object
build.codemodel.dependency.injection.DefaultOptionResolver
A
Resolver that instantiates Option subclasses via their Default-annotated
factory (no-arg constructor, static method, or static field) when no other resolver provides them.
This is the fallback resolver for Option types: if the primary ConfigurationResolver
returns empty (because the Configuration bag doesn't contain that option),
this resolver creates a default instance using the Default annotation.
- Author:
- reed.vonredwitz
- See Also:
-
Method Summary
Modifier and TypeMethodDescriptionstatic DefaultOptionResolverof(InjectionFramework framework) Creates aDefaultOptionResolver.resolve(Dependency dependency) Attempts to resolve a value for the type specified by theDependency.
-
Method Details
-
resolve
Description copied from interface:ResolverAttempts to resolve a value for the type specified by theDependency.- Specified by:
resolvein interfaceResolver<Object>- Parameters:
dependency- theDependency- Returns:
- the
Optionalvalue if resolvable,Optional.empty()otherwise
-
of
Creates aDefaultOptionResolver.- Parameters:
framework- theInjectionFramework- Returns:
- a new
DefaultOptionResolver
-