Overview | Package | Class | Use | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

## com.sun.jersey.spi
Interface MessageBodyWorkers

All Known Implementing Classes:
  MessageBodyFactory

    public interface MessageBodyWorkers

An injectable interface providing lookup of `MessageBodyReader` and `MessageBodyWriter` instances.

Author:
  Paul.Sandoz@Sun.Com
See Also:
  `Context`, `MessageBodyReader`, `MessageBodyWriter`

Method Summary
`
`<T> javax.ws.rs.ext.MessageBodyReader<T>`
` | `getMessageBodyReader(java.lang.Class<T> type, java.lang.reflect.Type genericType, java.lang.annotation.Annotation[] annotations, javax.ws.rs.core.MediaType mediaType)` Get a message body reader that matches a set of criteria.
`
`<T> javax.ws.rs.ext.MessageBodyWriter<T>`
` | `getMessageBodyWriter(java.lang.Class<T> type, java.lang.reflect.Type genericType, java.lang.annotation.Annotation[] annotations, javax.ws.rs.core.MediaType mediaType)` Get a message body writer that matches a set of criteria.
`
`<T> javax.ws.rs.core.MediaType`
` | `getMessageBodyWriterMediaType(java.lang.Class<T> type, java.lang.reflect.Type genericType, java.lang.annotation.Annotation[] annotations, java.util.List<javax.ws.rs.core.MediaType> acceptableMediaTypes)` Get the most acceptable media type supported for a Java type given a set of acceptable media types.
`
`<T> java.util.List<javax.ws.rs.core.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.

Method Detail

### getMessageBodyReader

    <T> javax.ws.rs.ext.MessageBodyReader<T> getMessageBodyReader(java.lang.Class<T> type,
                                                                  java.lang.reflect.Type genericType,
                                                                  java.lang.annotation.Annotation[] annotations,
                                                                  javax.ws.rs.core.MediaType mediaType)

  Get a message body reader that matches a set of criteria.

  Type Parameters:
    `T` - the type of object to be read.
  Parameters:
    `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`.
  Returns:
    a MessageBodyReader that matches the supplied criteria or null if none is found.

### getMessageBodyWriter

    <T> javax.ws.rs.ext.MessageBodyWriter<T> getMessageBodyWriter(java.lang.Class<T> type,
                                                                  java.lang.reflect.Type genericType,
                                                                  java.lang.annotation.Annotation[] annotations,
                                                                  javax.ws.rs.core.MediaType mediaType)

  Get a message body writer that matches a set of criteria.

  Type Parameters:
    `T` - the type of the object that is to be written.
  Parameters:
    `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`.
  Returns:
    a MessageBodyReader that matches the supplied criteria or null if none is found.

### getMessageBodyWriterMediaTypes

    <T> java.util.List<javax.ws.rs.core.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.

  Type Parameters:
    `T` - the type of object that is to be written.
  Parameters:
    `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`.
  Returns:
    the list of supported media types, the list is ordered as follows: a/b < a/* < \*\/*

### getMessageBodyWriterMediaType

    <T> javax.ws.rs.core.MediaType getMessageBodyWriterMediaType(java.lang.Class<T> type,
                                                                 java.lang.reflect.Type genericType,
                                                                 java.lang.annotation.Annotation[] annotations,
                                                                 java.util.List<javax.ws.rs.core.MediaType> acceptableMediaTypes)

  Get the most acceptable media type supported for a Java type given a set of acceptable media types.

  Type Parameters:
    `T` - the type of object that is to be written.
  Parameters:
    `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.
  Returns:
    the best media types

Overview | Package | Class | Use | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

Copyright © 2008 Sun Microsystems, Inc. All Rights Reserved.