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> -
Field Summary
Fields inherited from class io.micronaut.core.bind.annotation.AbstractArgumentBinder
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.protected io.micronaut.core.bind.ArgumentBinder.BindingResult<T> bindDefaultValue(io.micronaut.core.convert.ArgumentConversionContext<T> context) Try to bind the defaultValue, if any specified.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, doBind, doBind, doConvert, doConvert, doResolve, doResolve, getFallbackFormat, getParameterName, resolvedParameterNameMethods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface io.micronaut.http.bind.binders.RequestArgumentBinder
createSpecific
-
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
-
bindDefaultValue
protected io.micronaut.core.bind.ArgumentBinder.BindingResult<T> bindDefaultValue(io.micronaut.core.convert.ArgumentConversionContext<T> context) Try to bind the defaultValue, if any specified.- Parameters:
context- The conversion context- Returns:
- The binding result
-