Package io.micronaut.core.bind
Class DefaultExecutableBinder<S>
java.lang.Object
io.micronaut.core.bind.DefaultExecutableBinder<S>
- Type Parameters:
S- The source type
- All Implemented Interfaces:
ExecutableBinder<S>
Default implementation of the
ExecutableBinder interface.-
Constructor Summary
ConstructorsConstructorDescriptionDefault constructor.DefaultExecutableBinder(@Nullable Map<Argument<?>, Object> preBound) A map of pre-bound values for any arguments that don't need to be dynamically bound. -
Method Summary
Modifier and TypeMethodDescription<T,R> BoundExecutable<T, R> bind(Executable<T, R> target, ArgumentBinderRegistry<S> registry, S source) Binds a givenExecutableusing the given registry and source object.<T,R> BoundExecutable<T, R> tryBind(Executable<T, R> target, ArgumentBinderRegistry<S> registry, S source) Binds a givenExecutableusing the given registry and source object.
-
Constructor Details
-
DefaultExecutableBinder
public DefaultExecutableBinder()Default constructor. -
DefaultExecutableBinder
A map of pre-bound values for any arguments that don't need to be dynamically bound.- Parameters:
preBound- The pre bound values
-
-
Method Details
-
bind
public <T,R> BoundExecutable<T,R> bind(Executable<T, R> target, ArgumentBinderRegistry<S> registry, S source) throws UnsatisfiedArgumentExceptionDescription copied from interface:ExecutableBinderBinds a givenExecutableusing the given registry and source object.- Specified by:
bindin interfaceExecutableBinder<S>- Type Parameters:
T- The executable target typeR- The executable return type- Parameters:
target- The target executableregistry- The registry to usesource- The binding source- Returns:
- The bound executable
- Throws:
UnsatisfiedArgumentException- When the executable could not be satisfied
-
tryBind
public <T,R> BoundExecutable<T,R> tryBind(Executable<T, R> target, ArgumentBinderRegistry<S> registry, S source) Description copied from interface:ExecutableBinderBinds a givenExecutableusing the given registry and source object. UnlikeExecutableBinder.bind(Executable, ArgumentBinderRegistry, Object)this method will not throw anUnsatisfiedArgumentExceptionif an argument cannot be bound. Instead, theBoundExecutable.getUnboundArguments()property will be populated with any arguments that could not be bound- Specified by:
tryBindin interfaceExecutableBinder<S>- Type Parameters:
T- The executable target typeR- The executable return type- Parameters:
target- The target executableregistry- The registry to usesource- The binding source- Returns:
- The bound executable
-