Class NettyConverters

java.lang.Object
io.micronaut.http.server.netty.converters.NettyConverters
All Implemented Interfaces:
TypeConverterRegistrar

@Prototype @Internal public class NettyConverters extends Object implements TypeConverterRegistrar
Factory for bytebuf related converters.
Since:
1.0
Author:
graemerocher
  • Constructor Details

  • Method Details

    • register

      public void register(MutableConversionService conversionService)
      Description copied from interface: TypeConverterRegistrar
      Interface for registrars of TypeConverter instances.
      Specified by:
      register in interface TypeConverterRegistrar
      Parameters:
      conversionService - The ConversionService
    • fileUploadToObjectConverter

      protected TypeConverter<io.netty.handler.codec.http.multipart.FileUpload,Object> fileUploadToObjectConverter()
      Returns:
      A FileUpload to CompletedFileUpload converter
    • byteBufToObjectConverter

      protected TypeConverter<io.netty.buffer.ByteBuf,Object> byteBufToObjectConverter()
      Returns:
      A converter that returns bytebufs to objects
    • refCountAwareConvert

      public static <T> Optional<T> refCountAwareConvert(ConversionService service, io.netty.util.ReferenceCounted input, ArgumentConversionContext<T> context)
      This method converts a netty reference counted object and transfers release ownership to the new object.
      Type Parameters:
      T - Target type
      Parameters:
      service - The conversion service
      context - The context to convert to
      input - The object to convert
      Returns:
      The converted object
    • refCountAwareConvert

      public static <T> Optional<T> refCountAwareConvert(ConversionService service, io.netty.util.ReferenceCounted input, Class<T> targetType, ConversionContext context)
      This method converts a netty reference counted object and transfers release ownership to the new object.
      Type Parameters:
      T - Target type
      Parameters:
      service - The conversion service
      input - The object to convert
      targetType - The type to convert to
      context - The context to convert with
      Returns:
      The converted object