Package io.micronaut.core.bind
Interface ExecutableBinder<S>
- Type Parameters:
S
- The source type
- All Known Subinterfaces:
ExecutableBeanContextBinder
- All Known Implementing Classes:
DefaultExecutableBeanContextBinder
,DefaultExecutableBinder
public interface ExecutableBinder<S>
An ExecutableBinder is capable of taking a target Executable
and fulfilling the argument
requirements using the provided binding source and ArgumentBinderRegistry
The returned BoundExecutable
will have all of the required arguments bound and
can then be called simply by calling invoke.
If an argument could not be bound then an exception will be
-
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.
-
Method Details
-
bind
<T,R> BoundExecutable<T,R> bind(Executable<T, R> target, ArgumentBinderRegistry<S> registry, S source) throws UnsatisfiedArgumentExceptionBinds a givenExecutable
using the given registry and source object.- 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
<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. Unlikebind(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- 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
-