Package io.micronaut.http.body
Class ContextlessMessageBodyHandlerRegistry
java.lang.Object
io.micronaut.http.body.ContextlessMessageBodyHandlerRegistry
- All Implemented Interfaces:
MessageBodyHandlerRegistry
MessageBodyHandlerRegistry
implementation that does not need an application context.- Since:
- 4.0.0
- Author:
- Jonas Konrad
-
Field Summary
Fields inherited from interface io.micronaut.http.body.MessageBodyHandlerRegistry
EMPTY
-
Constructor Summary
ConstructorDescriptionContextlessMessageBodyHandlerRegistry
(ApplicationConfiguration applicationConfiguration, ByteBufferFactory<?, ?> byteBufferFactory, TypedMessageBodyHandler<?>... otherRawHandlers) -
Method Summary
Modifier and TypeMethodDescriptionvoid
add
(@NonNull MediaType mediaType, @NonNull MessageBodyHandler<?> handler) Add aMessageBodyHandler
for the given media type.void
add
(@NonNull MediaType mediaType, @NonNull MessageBodyReader<?> handler) Add aMessageBodyReader
for the given media type.void
add
(@NonNull MediaType mediaType, @NonNull MessageBodyWriter<?> handler) Add aMessageBodyWriter
for the given media type.<T> Optional<MessageBodyReader<T>>
findReader
(Argument<T> type, List<MediaType> mediaTypes) Find a reader for the type and annotation metadata at declaration point.protected <T> MessageBodyReader<T>
findReaderImpl
(Argument<T> type, List<MediaType> mediaTypes) <T> Optional<MessageBodyWriter<T>>
findWriter
(Argument<T> type, List<MediaType> mediaTypes) Find a writer for the type and annotation metadata at declaration point.protected <T> MessageBodyWriter<T>
findWriterImpl
(Argument<T> type, List<MediaType> mediaTypes) Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
Methods inherited from interface io.micronaut.http.body.MessageBodyHandlerRegistry
findReader, findReader, findWriter, findWriter, getReader, getWriter
-
Constructor Details
-
ContextlessMessageBodyHandlerRegistry
public ContextlessMessageBodyHandlerRegistry(ApplicationConfiguration applicationConfiguration, ByteBufferFactory<?, ?> byteBufferFactory, TypedMessageBodyHandler<?>... otherRawHandlers) - Parameters:
applicationConfiguration
- The configurationbyteBufferFactory
- The buffer factoryotherRawHandlers
- Raw handlers to add on top of the default ones
-
-
Method Details
-
add
public void add(@NonNull @NonNull MediaType mediaType, @NonNull @NonNull MessageBodyHandler<?> handler) Add aMessageBodyHandler
for the given media type.- Parameters:
mediaType
- The media type the handler applies tohandler
- The handler
-
add
public void add(@NonNull @NonNull MediaType mediaType, @NonNull @NonNull MessageBodyWriter<?> handler) Add aMessageBodyWriter
for the given media type.- Parameters:
mediaType
- The media type the handler applies tohandler
- The handler
-
add
public void add(@NonNull @NonNull MediaType mediaType, @NonNull @NonNull MessageBodyReader<?> handler) Add aMessageBodyReader
for the given media type.- Parameters:
mediaType
- The media type the handler applies tohandler
- The handler
-
findReaderImpl
-
findWriterImpl
-
findReader
Description copied from interface:MessageBodyHandlerRegistry
Find a reader for the type and annotation metadata at declaration point.- Specified by:
findReader
in interfaceMessageBodyHandlerRegistry
- Type Parameters:
T
- The generic type- Parameters:
type
- The typemediaTypes
- The media type- Returns:
- A message body reader if it is existing.
-
findWriter
Description copied from interface:MessageBodyHandlerRegistry
Find a writer for the type and annotation metadata at declaration point.- Specified by:
findWriter
in interfaceMessageBodyHandlerRegistry
- Type Parameters:
T
- The generic type- Parameters:
type
- The typemediaTypes
- The media type- Returns:
- A message body writer if it is existing.
-