Class QualifiedResolver<T>
java.lang.Object
build.codemodel.dependency.injection.QualifiedResolver<T>
- All Implemented Interfaces:
Resolver<T>
-
Method Summary
Modifier and TypeMethodDescriptionstatic <T> QualifiedResolver<T> of(Class<? extends Annotation> annotationClass, T object) Creates a newQualifiedResolverthat resolvesInjectableDependencys to the provided non-nullObjectwhen theDependency.typeUsage()is annotated with the specifiedAnnotationclass.static <T> QualifiedResolver<T> Creates a newQualifiedResolverthat resolvesInjectableDependencys to the provided non-nullObjectwhen theDependency.typeUsage()satisfies specifiedAnnotationTypeUsagePredicate.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
public static <T> QualifiedResolver<T> of(Predicate<? super build.codemodel.foundation.usage.AnnotationTypeUsage> predicate, T object) Creates a newQualifiedResolverthat resolvesInjectableDependencys to the provided non-nullObjectwhen theDependency.typeUsage()satisfies specifiedAnnotationTypeUsagePredicate.- Type Parameters:
T- the type of theObjectto inject- Parameters:
predicate- theAnnotationTypeUsagePredicateto be satisfiedobject- the non-nullObjectto inject- Returns:
- a new
QualifiedResolver
-
of
Creates a newQualifiedResolverthat resolvesInjectableDependencys to the provided non-nullObjectwhen theDependency.typeUsage()is annotated with the specifiedAnnotationclass.- Type Parameters:
T- the type of theObjectto inject- Parameters:
annotationClass- theClassof theAnnotationto matchobject- the non-nullObjectto inject- Returns:
- a new
QualifiedResolver
-