Class OptionalResolver<T>
java.lang.Object
build.codemodel.dependency.injection.OptionalResolver<T>
-
Method Summary
Modifier and TypeMethodDescriptionstatic <T> OptionalResolver<T> Creates an emptyOptionalResolver.static <T, O extends T>
OptionalResolver<T> Creates anOptionalResolver.static <T, O extends T>
OptionalResolver<T> Creates anOptionalResolver.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<T>- Parameters:
dependency- theDependency- Returns:
- the
Optionalvalue if resolvable,Optional.empty()otherwise
-
of
Creates anOptionalResolver.- Type Parameters:
T- the type of theClassto resolveO- the type of theObjectto resolve- Parameters:
objectClass- the class of the object to resolve in anOptionalobject- the object to resolve in anOptional. May benull- Returns:
- an
OptionalResolver
-
of
public static <T, O extends T> OptionalResolver<T> of(Class<? extends T> objectClass, Supplier<O> objectSupplier) Creates anOptionalResolver. -
empty
Creates an emptyOptionalResolver.- Type Parameters:
T- the type of theClassto resolve- Parameters:
objectClass- theClassof theObjectto resolve as anOptional- Returns:
- an
OptionalResolver
-