Package io.micronaut.http.bind.binders
Class QueryValueArgumentBinder<T>
java.lang.Object
io.micronaut.core.bind.annotation.AbstractArgumentBinder<T>
io.micronaut.http.bind.binders.QueryValueArgumentBinder<T>
- Type Parameters:
T
- The argument type
- All Implemented Interfaces:
AnnotatedArgumentBinder<QueryValue,
,T, HttpRequest<?>> ArgumentBinder<T,
,HttpRequest<?>> AnnotatedRequestArgumentBinder<QueryValue,
,T> RequestArgumentBinder<T>
public class QueryValueArgumentBinder<T>
extends AbstractArgumentBinder<T>
implements AnnotatedRequestArgumentBinder<QueryValue,T>
A binder for binding arguments annotated with @QueryValue.
- Since:
- 2.0.2
- Author:
- James Kleeh, Andriy Dmytruk
-
Nested Class Summary
Nested classes/interfaces inherited from interface io.micronaut.core.bind.ArgumentBinder
ArgumentBinder.BindingResult<T>
-
Field Summary
Fields inherited from class io.micronaut.core.bind.annotation.AbstractArgumentBinder
conversionService
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionbind
(ArgumentConversionContext<T> context, HttpRequest<?> source) Binds the argument withQueryValue
annotation to the request (Also binds without annotation if request body is not permitted).Methods inherited from class io.micronaut.core.bind.annotation.AbstractArgumentBinder
doBind, doBind, doConvert, doConvert, doResolve, getFallbackFormat
-
Constructor Details
-
QueryValueArgumentBinder
Constructor.- Parameters:
conversionService
- conversion service
-
-
Method Details
-
getAnnotationType
- Specified by:
getAnnotationType
in interfaceAnnotatedArgumentBinder<QueryValue,
T, HttpRequest<?>> - Returns:
- The annotation type.
-
bind
public ArgumentBinder.BindingResult<T> bind(ArgumentConversionContext<T> context, HttpRequest<?> source) Binds the argument withQueryValue
annotation to the request (Also binds without annotation if request body is not permitted).It will first try to convert to ConvertibleMultiValues type and if conversion is successful, add the corresponding parameters to the request. (By default the conversion will be successful if the
Format
annotation is present and has one of the supported values - seeMultiValuesConverterFactory
for specific converters). Otherwise, the uri template will be used to deduce what will be done with the request. For example, simple parameters are converted toString
- Specified by:
bind
in interfaceArgumentBinder<T,
HttpRequest<?>> - Parameters:
context
- TheArgumentConversionContext
source
- The source- Returns:
- An
Optional
of the value. If no binding was possibleOptional.empty()
-