Interface BindingBuilder<T>
- Type Parameters:
T- the type ofObjectthat is injectable
- All Known Implementing Classes:
AbstractBindingBuilder
public interface BindingBuilder<T>
A fluent builder for
Bindings.- Since:
- Oct-2024
- Author:
- brian.oliver
-
Method Summary
Modifier and TypeMethodDescriptionConfigures theBindingBuilderto createBindings injectable withDependencys that require named values, the name being specified using theNamedannotation.default voidRegisters aBindingof the bound value to each non-java.*interface in its type hierarchy.default voidasAllInterfaces(Predicate<Class<?>> filter) Creates aBindingthat uses the specified value for injection.toOverriding(Class<? extends T> implementationClass) toOverriding(Supplier<T> supplier) toOverriding(T value) with(build.codemodel.foundation.usage.AnnotationTypeUsage qualifier) with(Annotation annotation) with(Class<? extends Annotation> annotationClass) Configures theBindingBuilderto createBindings requiring the specified MarkerQualifierAnnotation.
-
Method Details
-
to
-
to
-
to
-
as
Configures theBindingBuilderto createBindings injectable withDependencys that require named values, the name being specified using theNamedannotation.- Parameters:
name- the name- Returns:
- this
BindingBuilderto permit fluent-style method invocation
-
with
Configures theBindingBuilderto createBindings requiring the specified MarkerQualifierAnnotation.- Parameters:
annotationClass- theClassofAnnotation- Returns:
- this
BindingBuilderto permit fluent-style method invocation
-
with
- Parameters:
annotation- theAnnotation- Returns:
- this
BindingBuilderto permit fluent-style method invocation
-
with
- Parameters:
qualifier- theAnnotationTypeUsage- Returns:
- this
BindingBuilderto permit fluent-style method invocation
-
toOverriding
Replaces an existingBindingfor this type with the specified value, or registers a newBindingif none exists. Unliketo(Object), this does not throwBindingAlreadyExistsExceptionwhen a binding is already registered.- Parameters:
value- the value- Returns:
- the newly registered
Binding
-
toOverriding
-
toOverriding
-
asAllInterfaces
default void asAllInterfaces()Registers aBindingof the bound value to each non-java.*interface in its type hierarchy. Equivalent to callingasAllInterfaces(Predicate)with a filter that excludes interfaces whose package name starts with"java.".Example:
context.bind(myService).asAllInterfaces(); // equivalent to registering bind(ServiceInterface.class).to(myService) for every user interface- Throws:
UnsupportedOperationException- if called on a builder that was not created viaContext.bind(Object)
-
asAllInterfaces
Registers aBindingof the bound value to each interface in its type hierarchy that matches the suppliedPredicate.- Parameters:
filter- aPredicateapplied to each interfaceClass; only matching interfaces are bound- Throws:
UnsupportedOperationException- if called on a builder that was not created viaContext.bind(Object)
-