org.jboss.resteasy.plugins.providers
Class AbstractEntityProvider<T>

java.lang.Object
  extended by org.jboss.resteasy.plugins.providers.AbstractEntityProvider<T>
Type Parameters:
T -
All Implemented Interfaces:
MessageBodyReader<T>, MessageBodyWriter<T>
Direct Known Subclasses:
AbstractJAXBProvider, DataSourceProvider, IIOImageProvider, MimeMultipartProvider, YamlProvider

public abstract class AbstractEntityProvider<T>
extends java.lang.Object
implements MessageBodyReader<T>, MessageBodyWriter<T>

A AbstractEntityProvider.

Version:
$Revision: $
Author:
Constructor Summary
AbstractEntityProvider()
           
 
Method Summary
 long getSize(T t, java.lang.Class<?> type, java.lang.reflect.Type genericType, java.lang.annotation.Annotation[] annotations, MediaType mediaType)
          Called before writeTo to ascertain the length in bytes of the serialized form of t.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface javax.ws.rs.ext.MessageBodyReader
isReadable, readFrom
 
Methods inherited from interface javax.ws.rs.ext.MessageBodyWriter
isWriteable, writeTo
 

Constructor Detail

AbstractEntityProvider

public AbstractEntityProvider()
Method Detail

getSize

public long getSize(T t,
                    java.lang.Class<?> type,
                    java.lang.reflect.Type genericType,
                    java.lang.annotation.Annotation[] annotations,
                    MediaType mediaType)
Description copied from interface: MessageBodyWriter
Called before writeTo to ascertain the length in bytes of the serialized form of t. A non-negative return value is used in a HTTP Content-Length header.

Specified by:
getSize in interface MessageBodyWriter<T>
Parameters:
t - the instance to write
type - the class of object that is to be written.
genericType - the type of object to be written, obtained either by reflection of a resource method return type or by inspection of the returned instance. GenericEntity provides a way to specify this information at runtime.
annotations - an array of the annotations on the resource method that returns the object.
mediaType - the media type of the HTTP entity.
Returns:
length in bytes or -1 if the length cannot be determined in advance


Copyright © 2009. All Rights Reserved.