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

    Fields
    Modifier and Type
    Field
    Description
    protected final io.micronaut.core.convert.ConversionService
     
  • Constructor Summary

    Constructors
    Constructor
    Description
    DefaultBodyAnnotationBinder(io.micronaut.core.convert.ConversionService conversionService)
     
  • Method Summary

    Modifier and Type
    Method
    Description
    final 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<?>>
    Try to bind from the full body of the request to a ConvertibleValues for argument spreading.
    final Class<Body>
     

    Methods inherited from class io.micronaut.core.bind.annotation.AbstractArgumentBinder

    doBind, doBind, doConvert, doConvert, doResolve, getFallbackFormat

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • 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

      public final Class<Body> getAnnotationType()
      Specified by:
      getAnnotationType in interface io.micronaut.core.bind.annotation.AnnotatedArgumentBinder<Body,T,HttpRequest<?>>
      Specified by:
      getAnnotationType in interface BodyArgumentBinder<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:
      bind in interface io.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 from bindFullBodyConvertibleValues(HttpRequest).
      Parameters:
      context - The context to convert with
      source - The request
      bodyComponent - 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 a ConvertibleValues for argument spreading.
      Parameters:
      source - The request
      Returns:
      The body as a ConvertibleValues instance
    • 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 context
      source - The request
      Returns:
      The binding result