Errai 3.0.1-SNAPSHOT

org.jboss.errai.marshalling.client.api
Class AbstractMarshallingSession

java.lang.Object
  extended by org.jboss.errai.marshalling.client.api.AbstractMarshallingSession
All Implemented Interfaces:
MarshallingSession
Direct Known Subclasses:
DecodingSession, EncodingSession, MarshallerFramework.JSONMarshallingSession

public abstract class AbstractMarshallingSession
extends Object
implements MarshallingSession

Author:
Mike Brock

Constructor Summary
protected AbstractMarshallingSession(MappingContext context)
           
 
Method Summary
 String getAssumedElementType()
           
 String getAssumedMapKeyType()
           
 String getAssumedMapValueType()
           
 MappingContext getMappingContext()
           
 Marshaller<Object> getMarshallerInstance(String fqcn)
          Returns a marshaller for the provided type.
<T> T
getObject(Class<T> type, String hashCode)
          Looks up the object based on the specified hashCode identifier.
 String getObject(Object reference)
          Returns a unique identifier for the specified object reference.
 boolean hasObject(Object reference)
          Checks if the object is already in the context based on the object reference.
 boolean hasObject(String hashCode)
          Checks if the object is already in the context based on the hash code.
<T> T
recordObject(String hashCode, T instance)
          Records a new object to the session with the specified hashCode identifier.
 void resetAssumedTypes()
           
 void setAssumedElementType(String assumendElementType)
           
 void setAssumedMapKeyType(String assumedMapKeyType)
           
 void setAssumedMapValueType(String assumedMapValueType)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface org.jboss.errai.marshalling.client.api.MarshallingSession
determineTypeFor
 

Constructor Detail

AbstractMarshallingSession

protected AbstractMarshallingSession(MappingContext context)
Method Detail

getMarshallerInstance

public Marshaller<Object> getMarshallerInstance(String fqcn)
Description copied from interface: MarshallingSession
Returns a marshaller for the provided type.

Specified by:
getMarshallerInstance in interface MarshallingSession
Parameters:
fqcn - fully qualified class name of the type to be marshalled, in the format returned by Class.getName() and MetaClass.getFullyQualifiedName(). Null is permitted, and yields a marshaller that can only marshal and demarshal null references.
Returns:
marshaller instance, or null if no marshaller was found for the given type.

getMappingContext

public MappingContext getMappingContext()
Specified by:
getMappingContext in interface MarshallingSession

hasObject

public boolean hasObject(String hashCode)
Description copied from interface: MarshallingSession
Checks if the object is already in the context based on the hash code.

Specified by:
hasObject in interface MarshallingSession
Parameters:
hashCode - the hash code
Returns:
true if the session contains the object reference.

hasObject

public boolean hasObject(Object reference)
Description copied from interface: MarshallingSession
Checks if the object is already in the context based on the object reference.

Specified by:
hasObject in interface MarshallingSession
Parameters:
reference - the entity reference
Returns:
true if the session contains the object reference.

getObject

public <T> T getObject(Class<T> type,
                       String hashCode)
Description copied from interface: MarshallingSession
Looks up the object based on the specified hashCode identifier. Returns null if the specified identifier does not exist.

Specified by:
getObject in interface MarshallingSession
Type Parameters:
T - the type of entity being looked up
Parameters:
type - the type of entity being looked up
hashCode - the identifier of the entity within the session
Returns:
the instance of the entity or null if not present

recordObject

public <T> T recordObject(String hashCode,
                          T instance)
Description copied from interface: MarshallingSession
Records a new object to the session with the specified hashCode identifier.

Specified by:
recordObject in interface MarshallingSession
Parameters:
hashCode - a unique identifier
instance - the instance of the entity.

getObject

public String getObject(Object reference)
Description copied from interface: MarshallingSession
Returns a unique identifier for the specified object reference. Returns a new identifier if the object is unknown to the session, or returns the existing one if it is known.

Specified by:
getObject in interface MarshallingSession
Parameters:
reference - the entity reference
Returns:
a new or existing identifier within this session

getAssumedElementType

public String getAssumedElementType()
Specified by:
getAssumedElementType in interface MarshallingSession

setAssumedElementType

public void setAssumedElementType(String assumendElementType)
Specified by:
setAssumedElementType in interface MarshallingSession

getAssumedMapKeyType

public String getAssumedMapKeyType()
Specified by:
getAssumedMapKeyType in interface MarshallingSession

setAssumedMapKeyType

public void setAssumedMapKeyType(String assumedMapKeyType)
Specified by:
setAssumedMapKeyType in interface MarshallingSession

getAssumedMapValueType

public String getAssumedMapValueType()
Specified by:
getAssumedMapValueType in interface MarshallingSession

setAssumedMapValueType

public void setAssumedMapValueType(String assumedMapValueType)
Specified by:
setAssumedMapValueType in interface MarshallingSession

resetAssumedTypes

public void resetAssumedTypes()
Specified by:
resetAssumedTypes in interface MarshallingSession

Errai 3.0.1-SNAPSHOT

Copyright © 2013-2014 JBoss, a division of Red Hat. All Rights Reserved.