org.restlet.client.representation
Class ObjectRepresentation<T>

java.lang.Object
  extended by org.restlet.client.representation.Variant
      extended by org.restlet.client.representation.RepresentationInfo
          extended by org.restlet.client.representation.Representation
              extended by org.restlet.client.representation.CharacterRepresentation
                  extended by org.restlet.client.representation.StringRepresentation
                      extended by org.restlet.client.representation.ObjectRepresentation<T>
Type Parameters:
T - The class to serialize.

public class ObjectRepresentation<T>
extends StringRepresentation

Representation based on a serializable Java object. This internally reuses the GWT-RPC serialization logic.

Author:
Jerome Louvel

Field Summary
 
Fields inherited from class org.restlet.client.representation.Representation
UNKNOWN_SIZE
 
Constructor Summary
ObjectRepresentation(ClientProxy resource, T object)
          Constructor for serialization.
ObjectRepresentation(RemoteService remoteService, T object)
          Constructor for serialization.
ObjectRepresentation(SerializationStreamFactory serializationStreamFactory, T object)
          Constructor for serialization.
ObjectRepresentation(String serializedObject, ClientProxy resource)
          Constructor for deserialization.
ObjectRepresentation(String serializedObject, RemoteService remoteService)
          Constructor for deserialization.
ObjectRepresentation(String serializedObject, SerializationStreamFactory serializationStreamFactory)
          Constructor for deserialization.
ObjectRepresentation(String serializedObject, SerializationStreamFactory serializationStreamFactory, boolean string)
          Constructor for deserialization.
 
Method Summary
 T getObject()
          The wrapped object.
 SerializationStreamFactory getSerializationStreamFactory()
          Returns the serialization stream factory.
 String getText()
          Converts the representation to a string value.
 boolean isString()
          Indicates if the serialized object is a String.
 void setObject(T object)
          Sets the wrapped object.
 void setSerializationStreamFactory(SerializationStreamFactory serializationStreamFactory)
          Sets the serialization stream factory.
 void setString(boolean string)
          Indicates if the serialized object is a String.
 
Methods inherited from class org.restlet.client.representation.StringRepresentation
getReader, getStream, release, setCharacterSet, setText, setText, toString, updateSize
 
Methods inherited from class org.restlet.client.representation.Representation
append, exhaust, getAvailableSize, getDisposition, getExpirationDate, getRange, getSize, hasKnownSize, isAvailable, isEmpty, isTransient, setAvailable, setDisposition, setExpirationDate, setRange, setSize, setTransient
 
Methods inherited from class org.restlet.client.representation.RepresentationInfo
getModificationDate, getTag, setModificationDate, setTag
 
Methods inherited from class org.restlet.client.representation.Variant
createClientInfo, equals, getCharacterSet, getEncodings, getLanguages, getLocationRef, getMediaType, includes, isCompatible, setEncodings, setLanguages, setLocationRef, setLocationRef, setMediaType
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

ObjectRepresentation

public ObjectRepresentation(ClientProxy resource,
                            T object)
Constructor for serialization.

Parameters:
resource - The remote resource from which to obtain the serialization stream factory.
object - The object to serialize.

ObjectRepresentation

public ObjectRepresentation(RemoteService remoteService,
                            T object)
Constructor for serialization.

Parameters:
remoteService - The remote service from which to obtain the serialization stream factory.
object - The object to serialize.

ObjectRepresentation

public ObjectRepresentation(SerializationStreamFactory serializationStreamFactory,
                            T object)
Constructor for serialization.

Parameters:
serializationStreamFactory - The serialization stream factory.
object - The object to serialize.

ObjectRepresentation

public ObjectRepresentation(String serializedObject,
                            ClientProxy resource)
Constructor for deserialization.

Parameters:
serializedObject - The object serialization text.
resource - The remote resource from which to obtain the serialization stream factory.

ObjectRepresentation

public ObjectRepresentation(String serializedObject,
                            RemoteService remoteService)
Constructor for deserialization.

Parameters:
serializedObject - The object serialization text.
remoteService - The remote service from which to obtain the serialization stream factory.

ObjectRepresentation

public ObjectRepresentation(String serializedObject,
                            SerializationStreamFactory serializationStreamFactory)
Constructor for deserialization.

Parameters:
serializedObject - The object serialization text.
serializationStreamFactory - The serialization stream factory.

ObjectRepresentation

public ObjectRepresentation(String serializedObject,
                            SerializationStreamFactory serializationStreamFactory,
                            boolean string)
Constructor for deserialization.

Parameters:
serializedObject - The object serialization text.
serializationStreamFactory - The serialization stream factory.
Method Detail

getObject

public T getObject()
The wrapped object. Triggers the deserialization if necessary.

Returns:
The wrapped object.

getSerializationStreamFactory

public SerializationStreamFactory getSerializationStreamFactory()
Returns the serialization stream factory.

Returns:
The serialization stream factory.

getText

public String getText()
Description copied from class: Representation
Converts the representation to a string value. Be careful when using this method as the conversion of large content to a string fully stored in memory can result in OutOfMemoryErrors being thrown.

Overrides:
getText in class StringRepresentation
Returns:
The representation as a string value.

isString

public boolean isString()
Indicates if the serialized object is a String.

Returns:
True if the serialized object is a String.

setObject

public void setObject(T object)
Sets the wrapped object.

Parameters:
object - The wrapped object.

setSerializationStreamFactory

public void setSerializationStreamFactory(SerializationStreamFactory serializationStreamFactory)
Sets the serialization stream factory.

Parameters:
serializationStreamFactory - The serialization stream factory.

setString

public void setString(boolean string)
Indicates if the serialized object is a String.

Parameters:
string - True if the serialized object is a String.


Copyright © 2005-2013 Restlet S.A.S..