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
ConstructorsConstructorDescriptionQueryValueArgumentBinder(ConversionService conversionService) Constructor.QueryValueArgumentBinder(ConversionService conversionService, Argument<T> argument) Constructor. -
Method Summary
Modifier and TypeMethodDescriptionbind(ArgumentConversionContext<T> context, HttpRequest<?> source) Binds the argument withQueryValueannotation to the request (Also binds without annotation if request body is not permitted).createSpecific(Argument<T> argument) Create a specific binder.protected StringgetParameterName(Argument<T> argument) Find the parameter name.Methods inherited from class io.micronaut.core.bind.annotation.AbstractArgumentBinder
doBind, doBind, doBind, doBind, doConvert, doConvert, doResolve, doResolve, getFallbackFormat, resolvedParameterName
-
Constructor Details
-
QueryValueArgumentBinder
Constructor.- Parameters:
conversionService- conversion service
-
QueryValueArgumentBinder
Constructor.- Parameters:
conversionService- conversion serviceargument- The argument
-
-
Method Details
-
createSpecific
Description copied from interface:RequestArgumentBinderCreate a specific binder.- Specified by:
createSpecificin interfaceArgumentBinder<T,HttpRequest<?>> - Specified by:
createSpecificin interfaceRequestArgumentBinder<T>- Parameters:
argument- The bound argument- Returns:
- The specific binder
-
getAnnotationType
- Specified by:
getAnnotationTypein interfaceAnnotatedArgumentBinder<QueryValue,T, HttpRequest<?>> - Returns:
- The annotation type.
-
bind
public ArgumentBinder.BindingResult<T> bind(ArgumentConversionContext<T> context, HttpRequest<?> source) Binds the argument withQueryValueannotation 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
Formatannotation is present and has one of the supported values - seeMultiValuesConverterFactoryfor 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:
bindin interfaceArgumentBinder<T,HttpRequest<?>> - Parameters:
context- TheArgumentConversionContextsource- The source- Returns:
- An
Optionalof the value. If no binding was possibleOptional.empty()
-
getParameterName
Description copied from class:AbstractArgumentBinderFind the parameter name.- Overrides:
getParameterNamein classAbstractArgumentBinder<T>- Parameters:
argument- The argument- Returns:
- The name
-