Package io.micronaut.core.bind
Interface ArgumentBinder<T,S>
- Type Parameters:
T- The argument typeS- The source type
- All Known Subinterfaces:
AnnotatedArgumentBinder<A,,T, S> AnnotatedRequestArgumentBinder<A,,T> BaseFilterProcessor.AsyncBodyBinder<T>,BeanPropertyBinder,BodyArgumentBinder<T>,NettyRequestArgumentBinder<T>,NonBlockingBodyArgumentBinder<T>,PostponedRequestArgumentBinder<T>,RequestArgumentBinder<T>,StreamedNettyRequestArgumentBinder<T>,TypeArgumentBinder<T,,S> TypedRequestArgumentBinder<T>,WebSocketStateBinder<T>
- All Known Implementing Classes:
AbstractAnnotatedArgumentBinder,BasicAuthArgumentBinder,CookieAnnotationBinder,CookieObjectArgumentBinder,DefaultBodyAnnotationBinder,DefaultUnmatchedRequestArgumentBinder,HeaderAnnotationBinder,LocaleArgumentBinder,MultipartBodyArgumentBinder,PartAnnotationBinder,PathVariableAnnotationBinder,QueryValueArgumentBinder,RequestAttributeAnnotationBinder,RequestBeanAnnotationBinder
- Functional Interface:
- This is a functional interface and can therefore be used as the assignment target for a lambda expression or method reference.
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
- Since:
- 1.0
- Author:
- Graeme Rocher
- See Also:
-
Nested Class Summary
Nested ClassesModifier and TypeInterfaceDescriptionstatic interfaceThe result of binding. -
Method Summary
Modifier and TypeMethodDescriptionbind(ArgumentConversionContext<T> context, S source) Bind the given argument from the given source.default @NonNull ArgumentBinder<T,S> createSpecific(@NonNull Argument<T> argument) Create a specific binder.
-
Method Details
-
createSpecific
@NonNull default @NonNull ArgumentBinder<T,S> createSpecific(@NonNull @NonNull Argument<T> argument) Create a specific binder.- Parameters:
argument- The bound argument- Returns:
- The specific binder
- Since:
- 4.8
-
bind
Bind the given argument from the given source.- Parameters:
context- TheArgumentConversionContextsource- The source- Returns:
- An
Optionalof the value. If no binding was possibleOptional.empty()
-