Package io.micronaut.http.bind.binders
Class DefaultBodyAnnotationBinder<T>
java.lang.Object
io.micronaut.core.bind.annotation.AbstractArgumentBinder<T>
io.micronaut.http.bind.binders.DefaultBodyAnnotationBinder<T>
- Type Parameters:
T- A type
- All Implemented Interfaces:
io.micronaut.core.bind.annotation.AnnotatedArgumentBinder<Body,,T, HttpRequest<?>> io.micronaut.core.bind.ArgumentBinder<T,,HttpRequest<?>> AnnotatedRequestArgumentBinder<Body,,T> BodyArgumentBinder<T>,RequestArgumentBinder<T>
@Singleton
public class DefaultBodyAnnotationBinder<T>
extends io.micronaut.core.bind.annotation.AbstractArgumentBinder<T>
implements BodyArgumentBinder<T>
Binds a String body argument.
- Since:
- 1.0
-
Nested Class Summary
Nested classes/interfaces inherited from interface io.micronaut.core.bind.ArgumentBinder
io.micronaut.core.bind.ArgumentBinder.BindingResult<T extends Object> -
Field Summary
FieldsModifier and TypeFieldDescriptionprotected final io.micronaut.core.convert.ConversionService -
Constructor Summary
ConstructorsConstructorDescriptionDefaultBodyAnnotationBinder(io.micronaut.core.convert.ConversionService conversionService) -
Method Summary
Modifier and TypeMethodDescriptionfinal io.micronaut.core.bind.ArgumentBinder.BindingResult<T>bind(io.micronaut.core.convert.ArgumentConversionContext<T> context, HttpRequest<?> source) protected io.micronaut.core.bind.ArgumentBinder.BindingResult<T>bindBodyPart(io.micronaut.core.convert.ArgumentConversionContext<T> context, HttpRequest<?> source, String bodyComponent) Bind a part of the body, for argument spreading.io.micronaut.core.bind.ArgumentBinder.BindingResult<T>bindFullBody(io.micronaut.core.convert.ArgumentConversionContext<T> context, HttpRequest<?> source) Try to bind from the full body of the request, i.e.protected io.micronaut.core.bind.ArgumentBinder.BindingResult<io.micronaut.core.convert.value.ConvertibleValues<?>>bindFullBodyConvertibleValues(HttpRequest<?> source) Try to bind from the full body of the request to aConvertibleValuesfor argument spreading.Methods inherited from class io.micronaut.core.bind.annotation.AbstractArgumentBinder
doBind, doBind, doConvert, doConvert, doResolve, getFallbackFormat
-
Field Details
-
conversionService
protected final io.micronaut.core.convert.ConversionService conversionService
-
-
Constructor Details
-
DefaultBodyAnnotationBinder
public DefaultBodyAnnotationBinder(io.micronaut.core.convert.ConversionService conversionService) - Parameters:
conversionService- The conversion service
-
-
Method Details
-
getAnnotationType
- Specified by:
getAnnotationTypein interfaceio.micronaut.core.bind.annotation.AnnotatedArgumentBinder<Body,T, HttpRequest<?>> - Specified by:
getAnnotationTypein interfaceBodyArgumentBinder<T>- Returns:
- The required annotation type
-
bind
public final io.micronaut.core.bind.ArgumentBinder.BindingResult<T> bind(io.micronaut.core.convert.ArgumentConversionContext<T> context, HttpRequest<?> source) - Specified by:
bindin interfaceio.micronaut.core.bind.ArgumentBinder<T,HttpRequest<?>>
-
bindBodyPart
protected io.micronaut.core.bind.ArgumentBinder.BindingResult<T> bindBodyPart(io.micronaut.core.convert.ArgumentConversionContext<T> context, HttpRequest<?> source, String bodyComponent) Bind a part of the body, for argument spreading. By default, this gets the argument frombindFullBodyConvertibleValues(HttpRequest).- Parameters:
context- The context to convert withsource- The requestbodyComponent- The name of the component to bind to- Returns:
- The binding result
-
bindFullBodyConvertibleValues
protected io.micronaut.core.bind.ArgumentBinder.BindingResult<io.micronaut.core.convert.value.ConvertibleValues<?>> bindFullBodyConvertibleValues(HttpRequest<?> source) Try to bind from the full body of the request to aConvertibleValuesfor argument spreading.- Parameters:
source- The request- Returns:
- The body as a
ConvertibleValuesinstance
-
bindFullBody
public io.micronaut.core.bind.ArgumentBinder.BindingResult<T> bindFullBody(io.micronaut.core.convert.ArgumentConversionContext<T> context, HttpRequest<?> source) Try to bind from the full body of the request, i.e. no argument spreading.- Parameters:
context- The conversion contextsource- The request- Returns:
- The binding result
-