Show / Hide Table of Contents

Class SimplePofContext

Basic IPofContext implementation.

Inheritance
object
SimplePofContext
Implements
IPofContext
ISerializer
Inherited Members
object.Equals(object)
object.Equals(object, object)
object.GetHashCode()
object.GetType()
object.MemberwiseClone()
object.ReferenceEquals(object, object)
object.ToString()
Namespace: Tangosol.IO.Pof
Assembly: Coherence.dll
Syntax
public class SimplePofContext : IPofContext, ISerializer

Fields

m_referenceEnabled

true if POF Identity/Reference type support is enabled

Declaration
protected bool m_referenceEnabled
Field Value
Type Description
bool

m_serializerMap

A map of POF serializer objects, indexed by type identifier.

Declaration
protected IDictionary m_serializerMap
Field Value
Type Description
IDictionary

m_typeIdMap

A map that contains mappings from a registered user type into type identifier.

Declaration
protected IDictionary m_typeIdMap
Field Value
Type Description
IDictionary

m_typeMap

A map of user types, indexed by type identifier.

Declaration
protected IDictionary m_typeMap
Field Value
Type Description
IDictionary

Properties

IsReferenceEnabled

Determine if Identity/Reference type support is enabled for this SimplePofContext.

Declaration
public bool IsReferenceEnabled { get; set; }
Property Value
Type Description
bool

true if Identity/Reference type support is enabled

Methods

Deserialize(DataReader)

Deserialize an object from a stream by reading its state using the specified DataReader object.

Declaration
public virtual object Deserialize(DataReader reader)
Parameters
Type Name Description
DataReader reader

The DataReader with which to read the object's state.

Returns
Type Description
object

The deserialized user type instance.

Exceptions
Type Condition
IOException

If an I/O error occurs.

GetPofSerializer(int)

Return an IPofSerializer that can be used to serialize and deserialize an object of the specified user type to and from a POF stream.

Declaration
public virtual IPofSerializer GetPofSerializer(int typeId)
Parameters
Type Name Description
int typeId

The type identifier of the user type that can be serialized and deserialized using the returned IPofSerializer; must be non-negative.

Returns
Type Description
IPofSerializer

An IPofSerializer for the specified user type.

Exceptions
Type Condition
ArgumentException

If the specified user type is negative or unknown to this IPofContext.

GetType(int)

Determine the type associated with the given user type identifier.

Declaration
public virtual Type GetType(int typeId)
Parameters
Type Name Description
int typeId

The user type identifier; must be non-negative.

Returns
Type Description
Type

The type associated with the specified user type identifier.

Exceptions
Type Condition
ArgumentException

If the specified user type is negative or unknown to this IPofContext.

GetTypeName(int)

Determine the name of the type associated with a user type identifier.

Declaration
public virtual string GetTypeName(int typeId)
Parameters
Type Name Description
int typeId

The user type identifier; must be non-negative.

Returns
Type Description
string

The name of the type associated with the specified user type identifier.

Exceptions
Type Condition
ArgumentException

If the specified user type is negative or unknown to this IPofContext.

GetUserTypeIdentifier(object)

Determine the user type identifier associated with the given object.

Declaration
public virtual int GetUserTypeIdentifier(object o)
Parameters
Type Name Description
object o

An instance of a user type; must not be null.

Returns
Type Description
int

The type identifier of the user type associated with the given object.

Exceptions
Type Condition
ArgumentException

If the user type associated with the given object is unknown to this IPofContext.

ArgumentNullException

If the o is null.

GetUserTypeIdentifier(string)

Determine the user type identifier associated with the given type name.

Declaration
public virtual int GetUserTypeIdentifier(string typeName)
Parameters
Type Name Description
string typeName

The name of a user type; must not be null.

Returns
Type Description
int

The type identifier of the user type associated with the given type name.

Exceptions
Type Condition
ArgumentException

If the user type associated with the given type name is unknown to this IPofContext.

ArgumentNullException

If the typeName is null.

GetUserTypeIdentifier(Type)

Determine the user type identifier associated with the given type.

Declaration
public virtual int GetUserTypeIdentifier(Type type)
Parameters
Type Name Description
Type type

A user type; must not be null.

Returns
Type Description
int

The type identifier of the user type associated with the given type.

Exceptions
Type Condition
ArgumentException

If the user type associated with the given type is unknown to this IPofContext.

ArgumentNullException

If the type is null.

IsUserType(object)

Determine if the given object is of a user type known to this IPofContext.

Declaration
public virtual bool IsUserType(object o)
Parameters
Type Name Description
object o

The object to test; must not be null.

Returns
Type Description
bool

true iff the specified object is of a valid user type.

Exceptions
Type Condition
ArgumentNullException

If the o is null.

IsUserType(string)

Determine if the type with the given name is a user type known to this IPofContext.

Declaration
public virtual bool IsUserType(string typeName)
Parameters
Type Name Description
string typeName

The name of the type to test; must not be null.

Returns
Type Description
bool

true iff the type with the specified name is a valid user type.

Exceptions
Type Condition
ArgumentNullException

If the typeName is null.

IsUserType(Type)

Determine if the given type is a user type known to this IPofContext.

Declaration
public virtual bool IsUserType(Type type)
Parameters
Type Name Description
Type type

The type to test; must not be null.

Returns
Type Description
bool

true iff the specified type is a valid user type.

Exceptions
Type Condition
ArgumentNullException

If the type is null.

RegisterUserType(int, Type, IPofSerializer)

Associate a user type with a type identifier and IPofSerializer.

Declaration
public virtual void RegisterUserType(int typeId, Type type, IPofSerializer serializer)
Parameters
Type Name Description
int typeId

The type identifier of the specified user type; must be greater or equal to 0.

Type type

The user type to register with this PofContext; must not be null.

IPofSerializer serializer

The IPofSerializer that will be used to serialize and deserialize objects of the specified type.

Exceptions
Type Condition
ArgumentException

On invalid type identifer, type, or IPofSerializer.

Serialize(DataWriter, object)

Serialize an object to a stream by writing its state using the specified DataWriter object.

Declaration
public virtual void Serialize(DataWriter writer, object o)
Parameters
Type Name Description
DataWriter writer

The DataWriter with which to write the object's state.

object o

The object to serialize.

Exceptions
Type Condition
IOException

If an I/O error occurs.

UnregisterUserType(int)

Unregister a user type that was previously registered using the specified type identifier.

Declaration
public virtual void UnregisterUserType(int typeId)
Parameters
Type Name Description
int typeId

The type identifier of the user type to unregister.

Exceptions
Type Condition
ArgumentException

If the specified user type identifier is unknown to this IPofContext.

ValidateTypeId(int)

Ensure that the given user type identifier is valid.

Declaration
protected static void ValidateTypeId(int typeId)
Parameters
Type Name Description
int typeId

The user type identifier to validate.

Exceptions
Type Condition
ArgumentException

If the given user type identifier is negative.

Implements

IPofContext
ISerializer

See Also

PortableObjectSerializer
In this article
Back to top Copyright © 2000, 2024, Oracle and/or its affiliates.