Class NettyConverters
java.lang.Object
io.micronaut.http.server.netty.converters.NettyConverters
- All Implemented Interfaces:
TypeConverterRegistrar
Factory for bytebuf related converters.
- Since:
- 1.0
- Author:
- graemerocher
-
Constructor Summary
ConstructorDescriptionNettyConverters
(ConversionService conversionService, BeanProvider<MediaTypeCodecRegistry> decoderRegistryProvider, BeanProvider<ChannelOptionFactory> channelOptionFactory) Default constructor. -
Method Summary
Modifier and TypeMethodDescriptionprotected TypeConverter<io.netty.buffer.ByteBuf,
Object> protected TypeConverter<io.netty.handler.codec.http.multipart.FileUpload,
Object> static <T> Optional<T>
refCountAwareConvert
(ConversionService service, io.netty.util.ReferenceCounted input, ArgumentConversionContext<T> context) This method converts anetty reference counted object
and transfers release ownership to the new object.static <T> Optional<T>
refCountAwareConvert
(ConversionService service, io.netty.util.ReferenceCounted input, Class<T> targetType, ConversionContext context) This method converts anetty reference counted object
and transfers release ownership to the new object.void
register
(MutableConversionService conversionService) Interface for registrars ofTypeConverter
instances.
-
Constructor Details
-
NettyConverters
public NettyConverters(ConversionService conversionService, BeanProvider<MediaTypeCodecRegistry> decoderRegistryProvider, BeanProvider<ChannelOptionFactory> channelOptionFactory) Default constructor.- Parameters:
conversionService
- The conversion servicedecoderRegistryProvider
- The decoder registry providerchannelOptionFactory
- The decoder channel option factory
-
-
Method Details
-
register
Description copied from interface:TypeConverterRegistrar
Interface for registrars ofTypeConverter
instances.- Specified by:
register
in interfaceTypeConverterRegistrar
- Parameters:
conversionService
- TheConversionService
-
fileUploadToObjectConverter
protected TypeConverter<io.netty.handler.codec.http.multipart.FileUpload,Object> fileUploadToObjectConverter()- Returns:
- A FileUpload to CompletedFileUpload converter
-
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 anetty reference counted object
and transfers release ownership to the new object.- Type Parameters:
T
- Target type- Parameters:
service
- The conversion servicecontext
- The context to convert toinput
- 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 anetty reference counted object
and transfers release ownership to the new object.- Type Parameters:
T
- Target type- Parameters:
service
- The conversion serviceinput
- The object to converttargetType
- The type to convert tocontext
- The context to convert with- Returns:
- The converted object
-