Class ObjectRepresentation<T>
- java.lang.Object
-
- org.restlet.client.representation.Variant
-
- org.restlet.client.representation.RepresentationInfo
-
- org.restlet.client.representation.Representation
-
- org.restlet.client.representation.CharacterRepresentation
-
- org.restlet.client.representation.StringRepresentation
-
- 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
Constructors Constructor Description ObjectRepresentation(RemoteService remoteService, T object)Constructor for serialization.ObjectRepresentation(SerializationStreamFactory serializationStreamFactory, T object)Constructor for serialization.ObjectRepresentation(java.lang.String serializedObject, RemoteService remoteService)Constructor for deserialization.ObjectRepresentation(java.lang.String serializedObject, SerializationStreamFactory serializationStreamFactory)Constructor for deserialization.ObjectRepresentation(java.lang.String serializedObject, SerializationStreamFactory serializationStreamFactory, boolean string)Constructor for deserialization.ObjectRepresentation(java.lang.String serializedObject, ClientProxy resource)Constructor for deserialization.ObjectRepresentation(ClientProxy resource, T object)Constructor for serialization.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description TgetObject()The wrapped object.SerializationStreamFactorygetSerializationStreamFactory()Returns the serialization stream factory.java.lang.StringgetText()Converts the representation to a string value.booleanisString()Indicates if the serialized object is a String.voidsetObject(T object)Sets the wrapped object.voidsetSerializationStreamFactory(SerializationStreamFactory serializationStreamFactory)Sets the serialization stream factory.voidsetString(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, hashCode, includes, isCompatible, setEncodings, setLanguages, setLocationRef, setLocationRef, setMediaType
-
-
-
-
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(java.lang.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(java.lang.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(java.lang.String serializedObject, SerializationStreamFactory serializationStreamFactory)Constructor for deserialization.- Parameters:
serializedObject- The object serialization text.serializationStreamFactory- The serialization stream factory.
-
ObjectRepresentation
public ObjectRepresentation(java.lang.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 java.lang.String getText()
Description copied from class:RepresentationConverts 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:
getTextin classStringRepresentation- 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.
-
-