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
ConstructorDescriptionDefault 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 givenExecutable
using the given registry and source object.<T,
R> BoundExecutable<T, R> tryBind
(Executable<T, R> target, ArgumentBinderRegistry<S> registry, S source) Binds a givenExecutable
using 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:ExecutableBinder
Binds a givenExecutable
using the given registry and source object.- Specified by:
bind
in 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:ExecutableBinder
Binds a givenExecutable
using the given registry and source object. UnlikeExecutableBinder.bind(Executable, ArgumentBinderRegistry, Object)
this method will not throw anUnsatisfiedArgumentException
if an argument cannot be bound. Instead theBoundExecutable.getUnboundArguments()
property will be populated with any arguments that could not be bound- Specified by:
tryBind
in 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
-