Package io.micronaut.http.body
Interface MessageBodyHandlerRegistry
- All Known Implementing Classes:
ContextlessMessageBodyHandlerRegistry,DefaultMessageBodyHandlerRegistry
public interface MessageBodyHandlerRegistry
A registry of
MessageBodyReader and MessageBodyWriter.- Since:
- 4.0.0
-
Field Summary
Fields -
Method Summary
Modifier and TypeMethodDescriptiondefault <T> Optional<MessageBodyReader<T>>findReader(@NonNull Argument<T> type) Find a reader for the type and annotation metadata at declaration point.default <T> Optional<MessageBodyReader<T>>findReader(@NonNull Argument<T> type, @Nullable MediaType mediaType) Find a reader for the type and annotation metadata at declaration point.<T> Optional<MessageBodyReader<T>>Find a reader for the type and annotation metadata at declaration point.default <T> Optional<MessageBodyWriter<T>>findWriter(@NonNull Argument<T> type) Find a writer for the type and annotation metadata at declaration point.<T> Optional<MessageBodyWriter<T>>Find a writer for the type and annotation metadata at declaration point.default <T> Optional<MessageBodyWriter<T>>findWriter(@NonNull Argument<T> type, @Nullable MediaType mediaType) Find a writer for the type and annotation metadata at declaration point.default <T> @NonNull MessageBodyReader<T>Find a reader for the type and annotation metadata at declaration point.default <T> @NonNull MessageBodyWriter<T>Gets a writer for the type and annotation metadata at declaration point or fails withCodecException.
-
Field Details
-
EMPTY
An empty registry.
-
-
Method Details
-
getReader
@NonNull default <T> @NonNull MessageBodyReader<T> getReader(@NonNull @NonNull Argument<T> type, @Nullable @Nullable List<MediaType> mediaType) Find a reader for the type and annotation metadata at declaration point.- Type Parameters:
T- The generic type- Parameters:
type- The typemediaType- The media type- Returns:
- A message body reader if it is existing.
-
findReader
<T> Optional<MessageBodyReader<T>> findReader(@NonNull @NonNull Argument<T> type, @Nullable @Nullable List<MediaType> mediaType) Find a reader for the type and annotation metadata at declaration point.- Type Parameters:
T- The generic type- Parameters:
type- The typemediaType- The media type- Returns:
- A message body reader if it is existing.
-
findReader
default <T> Optional<MessageBodyReader<T>> findReader(@NonNull @NonNull Argument<T> type, @Nullable @Nullable MediaType mediaType) Find a reader for the type and annotation metadata at declaration point.- Type Parameters:
T- The generic type- Parameters:
type- The typemediaType- The media type- Returns:
- A message body reader if it is existing.
- Since:
- 4.6
-
findReader
Find a reader for the type and annotation metadata at declaration point.- Type Parameters:
T- The generic type- Parameters:
type- The type- Returns:
- A message body reader if it is existing.
- Since:
- 4.6
-
findWriter
<T> Optional<MessageBodyWriter<T>> findWriter(@NonNull @NonNull Argument<T> type, @NonNull @NonNull List<MediaType> mediaType) Find a writer for the type and annotation metadata at declaration point.- Type Parameters:
T- The generic type- Parameters:
type- The typemediaType- The media type- Returns:
- A message body writer if it is existing.
-
findWriter
default <T> Optional<MessageBodyWriter<T>> findWriter(@NonNull @NonNull Argument<T> type, @Nullable @Nullable MediaType mediaType) Find a writer for the type and annotation metadata at declaration point.- Type Parameters:
T- The generic type- Parameters:
type- The typemediaType- The media type- Returns:
- A message body writer if it is existing.
- Since:
- 4.6
-
findWriter
Find a writer for the type and annotation metadata at declaration point.- Type Parameters:
T- The generic type- Parameters:
type- The type- Returns:
- A message body writer if it is existing.
- Since:
- 4.6
-
getWriter
@NonNull default <T> @NonNull MessageBodyWriter<T> getWriter(@NonNull @NonNull Argument<T> type, @NonNull @NonNull List<MediaType> mediaType) Gets a writer for the type and annotation metadata at declaration point or fails withCodecException.- Type Parameters:
T- The generic type- Parameters:
type- The typemediaType- The media type- Returns:
- A message body writer if it is existing.
-