Class ContextlessMessageBodyHandlerRegistry

java.lang.Object
io.micronaut.http.body.ContextlessMessageBodyHandlerRegistry
All Implemented Interfaces:
MessageBodyHandlerRegistry

@Internal public final class ContextlessMessageBodyHandlerRegistry extends Object
MessageBodyHandlerRegistry implementation that does not need an application context.
Since:
4.0.0
  • Constructor Details

    • ContextlessMessageBodyHandlerRegistry

      public ContextlessMessageBodyHandlerRegistry(io.micronaut.runtime.ApplicationConfiguration applicationConfiguration, io.micronaut.core.io.buffer.ByteBufferFactory<?,?> byteBufferFactory, TypedMessageBodyHandler<?>... otherRawHandlers)
      Parameters:
      applicationConfiguration - The configuration
      byteBufferFactory - The buffer factory
      otherRawHandlers - 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 a MessageBodyHandler for the given media type.
      Parameters:
      mediaType - The media type the handler applies to
      handler - The handler
    • add

      public void add(@NonNull @NonNull MediaType mediaType, @NonNull @NonNull MessageBodyWriter<?> handler)
      Add a MessageBodyWriter for the given media type.
      Parameters:
      mediaType - The media type the handler applies to
      handler - The handler
    • add

      public void add(@NonNull @NonNull MediaType mediaType, @NonNull @NonNull MessageBodyReader<?> handler)
      Add a MessageBodyReader for the given media type.
      Parameters:
      mediaType - The media type the handler applies to
      handler - The handler
    • findReaderImpl

      protected <T> MessageBodyReader<T> findReaderImpl(io.micronaut.core.type.Argument<T> type, List<MediaType> mediaTypes)
    • findWriterImpl

      protected <T> MessageBodyWriter<T> findWriterImpl(io.micronaut.core.type.Argument<T> type, List<MediaType> mediaTypes)
    • findReader

      public <T> Optional<MessageBodyReader<T>> findReader(io.micronaut.core.type.Argument<T> type, List<MediaType> mediaTypes)
      Description copied from interface: MessageBodyHandlerRegistry
      Find a reader for the type and annotation metadata at declaration point.
      Specified by:
      findReader in interface MessageBodyHandlerRegistry
      Type Parameters:
      T - The generic type
      Parameters:
      type - The type
      mediaTypes - The media type
      Returns:
      A message body reader if it is existing.
    • findWriter

      public <T> Optional<MessageBodyWriter<T>> findWriter(io.micronaut.core.type.Argument<T> type, List<MediaType> mediaTypes)
      Description copied from interface: MessageBodyHandlerRegistry
      Find a writer for the type and annotation metadata at declaration point.
      Specified by:
      findWriter in interface MessageBodyHandlerRegistry
      Type Parameters:
      T - The generic type
      Parameters:
      type - The type
      mediaTypes - The media type
      Returns:
      A message body writer if it is existing.