Start line:  
End line:  

Snippet Preview

Snippet HTML Code

Stack Overflow Questions
  /*
   * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
   *
   * Copyright (c) 2010-2011 Oracle and/or its affiliates. All rights reserved.
   *
   * The contents of this file are subject to the terms of either the GNU
   * General Public License Version 2 only ("GPL") or the Common Development
   * and Distribution License("CDDL") (collectively, the "License").  You
   * may not use this file except in compliance with the License.  You can
  * obtain a copy of the License at
  * http://glassfish.java.net/public/CDDL+GPL_1_1.html
  * or packager/legal/LICENSE.txt.  See the License for the specific
  * language governing permissions and limitations under the License.
  *
  * When distributing the software, include this License Header Notice in each
  * file and include the License file at packager/legal/LICENSE.txt.
  *
  * GPL Classpath Exception:
  * Oracle designates this particular file as subject to the "Classpath"
  * exception as provided by Oracle in the GPL Version 2 section of the License
  * file that accompanied this code.
  *
  * Modifications:
  * If applicable, add the following below the License Header, with the fields
  * enclosed by brackets [] replaced by your own identifying information:
  * "Portions Copyright [year] [name of copyright owner]"
  *
  * Contributor(s):
  * If you wish your version of this file to be governed by only the CDDL or
  * only the GPL Version 2, indicate your decision by adding "[Contributor]
  * elects to include this software in this distribution under the [CDDL or GPL
  * Version 2] license."  If you don't indicate a single choice of license, a
  * recipient has the option to distribute your version of this file under
  * either the CDDL, the GPL Version 2 or to extend the choice of license to
  * its licensees as provided above.  However, if you add GPL Version 2 code
  * and therefore, elected the GPL Version 2 license, then the option applies
  * only if the new code is made subject to such option by the copyright
  * holder.
  */
 package com.sun.jersey.spi;
 
 import java.util.List;
 import java.util.Map;
 import javax.ws.rs.ext.MessageBodyWriter;
        
 
 public interface MessageBodyWorkers {
    
Get the map of media type to list of message body writers that are compatible with a media type.

Parameters:
mediaType the compatible media type.
Returns:
the map of media type to list of message body writers.
 
     public Map<MediaTypeList<MessageBodyReader>> getReaders(MediaType mediaType);

    
Get the map of media type to list of message body writers that are compatible with a media type.

Parameters:
mediaType the compatible media type.
Returns:
the map of media type to list of message body writers.
 
     public Map<MediaTypeList<MessageBodyWriter>> getWriters(MediaType mediaType);

    
Convert a map media type to list of message body readers to a string.

Parameters:
readers the map media type to list of message body readers
Returns:
the string representation.
 
     public String readersToString(Map<MediaTypeList<MessageBodyReader>> readers);

    
Convert a map media type to list of message body writers to a string.

Parameters:
writers the map media type to list of message body readers
Returns:
the string representation.
 
     public String writersToString(Map<MediaTypeList<MessageBodyWriter>> writers);

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

Parameters:
<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 javax.ws.rs.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.
    <T> MessageBodyReader<T> getMessageBodyReader(Class<T> typeType genericType
            Annotation annotations[], MediaType mediaType);
    
    
Get a message body writer that matches a set of criteria.

Parameters:
<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 javax.ws.rs.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.
    <T> MessageBodyWriter<T> getMessageBodyWriter(Class<T> typeType genericType
            Annotation annotations[], MediaType mediaType);
    
    
Get the list of media types supported for a Java type.

Parameters:
<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.
Returns:
the list of supported media types, the list is ordered as follows: a/b &lt a/* &lt *\\/*
            Class<T> type
            Type genericType,
            Annotation[] annotations);

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

Parameters:
<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.
Returns:
the best media types
            Class<T> type,
            Type genericType,
			Annotation[] annotations,
            List<MediaTypeacceptableMediaTypes);
New to GrepCode? Check out our FAQ X