Show / Hide Table of Contents

Class PofAnnotationSerializer

A PofAnnotationSerializer provides annotation based de/serialization.

Inheritance
object
PofAnnotationSerializer
Implements
IPofSerializer
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 PofAnnotationSerializer : IPofSerializer
Remarks

This serializer must be instantiated with the intended class which is eventually scanned for the presence of the following annotations.

  • Portable
  • PortableProperty
This serializer supports classes iff they are annotated with the type level annotation; Portable. This annotation is a marker annotation with no children.

All fields annotated with PortableProperty are explicitly deemed POF serializable with the option of specifying overrides to provide explicit behaviour such as:
  • Explicit POF indexes
  • Custom ICodec to specify concrete implementations / customizations

The Index (POF index) can be omitted iff the auto-indexing feature is enabled. This is enabled by instantiating this class with the autoIndex constructor argument. This feature determines the index based on any explicit indexes specified and the name of the portable properties. Currently objects with multiple versions is not supported. The following illustrates the auto index algorithm:
NameExplicit IndexDetermined Index
c11
a0
b2
NOTE: This implementation does support objects that implement Evolvable

Constructors

PofAnnotationSerializer(int, Type)

Constructs a PofAnnotationSerializer.

Declaration
public PofAnnotationSerializer(int typeId, Type type)
Parameters
Type Name Description
int typeId

The POF type id.

Type type

Type this serializer is aware of.

PofAnnotationSerializer(int, Type, bool)

Constructs a PofAnnotationSerializer.

Declaration
public PofAnnotationSerializer(int typeId, Type type, bool autoIndex)
Parameters
Type Name Description
int typeId

The POF type id.

Type type

Type this serializer is aware of.

bool autoIndex

Turns on the auto index feature.

Methods

Deserialize(IPofReader)

Deserialize a user type instance from a POF stream by reading its state using the specified IPofReader object.

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

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

Returns
Type Description
object

The deserialized user type instance.

Remarks

An implementation of IPofSerializer is required to follow the following steps in sequence for reading in an object of a user type:

  1. If the object is evolvable, the implementation must get the version by calling VersionId.
  2. The implementation may read any combination of the properties of the user type by using "read" methods of the IPofReader, but it must do so in the order of the property indexes.
  3. After all desired properties of the user type have been read, the implementation must terminate the reading of the user type by calling ReadRemainder().
Exceptions
Type Condition
IOException

If an I/O error occurs.

Serialize(IPofWriter, object)

Serialize a user type instance to a POF stream by writing its state using the specified IPofWriter object.

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

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

object o

The object to serialize.

Remarks

An implementation of IPofSerializer is required to follow the following steps in sequence for writing out an object of a user type:

  1. If the object is evolvable, the implementation must set the version by calling VersionId.
  2. The implementation may write any combination of the properties of the user type by using the "write" methods of the IPofWriter, but it must do so in the order of the property indexes.
  3. After all desired properties of the user type have been written, the implementation must terminate the writing of the user type by calling WriteRemainder(Binary).
Exceptions
Type Condition
IOException

If an I/O error occurs.

Implements

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