T
- The argument typeS
- The source type@FunctionalInterface public interface ArgumentBinder<T,S>
An interface capable of binding the value of an Argument
from a source
The selection of an ArgumentBinder
is done by the ArgumentBinderRegistry
. Selection could
be based on type, annotation or other factors such as the request media type
Unlike TypeConverter
instances binders can potentially handle complex
objects and typically work on conjunction with a ConvertibleValues
instance
An ArgumentBinder
can either be registered as a bean or by META-INF/services. In the case of the latter
it will be globally available at all times, whilst the former is only present when a io.micronaut.context.BeanContext
is initialized
TypeConverter
,
ConvertibleValues
Modifier and Type | Interface and Description |
---|---|
static interface |
ArgumentBinder.BindingResult<T>
The result of binding.
|
Modifier and Type | Method and Description |
---|---|
ArgumentBinder.BindingResult<T> |
bind(ArgumentConversionContext<T> context,
S source)
Bind the given argument from the given source.
|
ArgumentBinder.BindingResult<T> bind(ArgumentConversionContext<T> context, S source)
context
- The ArgumentConversionContext
source
- The sourceOptional
of the value. If no binding was possible Optional.empty()