public interface MessageBodyWorkers
MessageBodyReader
and
MessageBodyWriter
instances.Context
,
MessageBodyReader
,
MessageBodyWriter
Modifier and Type | Method and Description |
---|---|
<T> MessageBodyReader<T> |
getMessageBodyReader(java.lang.Class<T> type,
java.lang.reflect.Type genericType,
java.lang.annotation.Annotation[] annotations,
MediaType mediaType)
Get a message body reader that matches a set of criteria.
|
<T> MessageBodyWriter<T> |
getMessageBodyWriter(java.lang.Class<T> type,
java.lang.reflect.Type genericType,
java.lang.annotation.Annotation[] annotations,
MediaType mediaType)
Get a message body writer that matches a set of criteria.
|
<T> MediaType |
getMessageBodyWriterMediaType(java.lang.Class<T> type,
java.lang.reflect.Type genericType,
java.lang.annotation.Annotation[] annotations,
java.util.List<MediaType> acceptableMediaTypes)
Get the most acceptable media type supported for a Java type given a set
of acceptable media types.
|
<T> java.util.List<MediaType> |
getMessageBodyWriterMediaTypes(java.lang.Class<T> type,
java.lang.reflect.Type genericType,
java.lang.annotation.Annotation[] annotations)
Get the list of media types supported for a Java type.
|
java.util.Map<MediaType,java.util.List<MessageBodyReader>> |
getReaders(MediaType mediaType)
Get the map of media type to list of message body writers that are
compatible with a media type.
|
java.util.Map<MediaType,java.util.List<MessageBodyWriter>> |
getWriters(MediaType mediaType)
Get the map of media type to list of message body writers that are
compatible with a media type.
|
java.lang.String |
readersToString(java.util.Map<MediaType,java.util.List<MessageBodyReader>> readers)
Convert a map media type to list of message body readers to a string.
|
java.lang.String |
writersToString(java.util.Map<MediaType,java.util.List<MessageBodyWriter>> writers)
Convert a map media type to list of message body writers to a string.
|
java.util.Map<MediaType,java.util.List<MessageBodyReader>> getReaders(MediaType mediaType)
mediaType
- the compatible media type.java.util.Map<MediaType,java.util.List<MessageBodyWriter>> getWriters(MediaType mediaType)
mediaType
- the compatible media type.java.lang.String readersToString(java.util.Map<MediaType,java.util.List<MessageBodyReader>> readers)
readers
- the map media type to list of message body readersjava.lang.String writersToString(java.util.Map<MediaType,java.util.List<MessageBodyWriter>> writers)
writers
- the map media type to list of message body readers<T> MessageBodyReader<T> getMessageBodyReader(java.lang.Class<T> type, java.lang.reflect.Type genericType, java.lang.annotation.Annotation[] annotations, MediaType mediaType)
T
- the type of object to be read.mediaType
- the media type of the data that will be read, this will
be compared to the values of Consumes
for
each candidate reader and only matching readers will be queried.type
- the class of object to be read.genericType
- the type of object to be produced. E.g. if the
message body is to be converted into a method parameter, this will be
the formal type of the method parameter as returned by
Class.getGenericParameterTypes
.annotations
- an array of the annotations on the declaration of the
artifact that will be initialized with the produced instance. E.g. if the
message body is to be converted into a method parameter, this will be
the annotations on that parameter returned by
Class.getParameterAnnotations
.<T> MessageBodyWriter<T> getMessageBodyWriter(java.lang.Class<T> type, java.lang.reflect.Type genericType, java.lang.annotation.Annotation[] annotations, MediaType mediaType)
T
- the type of the object that is to be written.mediaType
- the media type of the data that will be written, this will
be compared to the values of Produces
for
each candidate writer and only matching writers will be queried.type
- the class of object that is to be written.genericType
- the type of object to be written. E.g. if the
message body is to be produced from a field, this will be
the declared type of the field as returned by
Field.getGenericType
.annotations
- an array of the annotations on the declaration of the
artifact that will be written. E.g. if the
message body is to be produced from a field, this will be
the annotations on that field returned by
Field.getDeclaredAnnotations
.<T> java.util.List<MediaType> getMessageBodyWriterMediaTypes(java.lang.Class<T> type, java.lang.reflect.Type genericType, java.lang.annotation.Annotation[] annotations)
T
- the type of object that is to be written.type
- the class of object that is to be written.genericType
- the type of object to be written. E.g. if the
message body is to be produced from a field, this will be
the declared type of the field as returned by
Field.getGenericType
.annotations
- an array of the annotations on the declaration of the
artifact that will be written. E.g. if the
message body is to be produced from a field, this will be
the annotations on that field returned by
Field.getDeclaredAnnotations
.<T> MediaType getMessageBodyWriterMediaType(java.lang.Class<T> type, java.lang.reflect.Type genericType, java.lang.annotation.Annotation[] annotations, java.util.List<MediaType> acceptableMediaTypes)
T
- the type of object that is to be written.type
- the class of object that is to be written.genericType
- the type of object to be written. E.g. if the
message body is to be produced from a field, this will be
the declared type of the field as returned by
Field.getGenericType
.annotations
- an array of the annotations on the declaration of the
artifact that will be written. E.g. if the
message body is to be produced from a field, this will be
the annotations on that field returned by
Field.getDeclaredAnnotations
.acceptableMediaTypes
- the list of acceptable media types, sorted
according to the quality with the media type of highest quality
occurring first first.Copyright © 2016 Oracle Corporation. All Rights Reserved.