Skip navigation links

Overview | Package | Class | Tree | Index | Help
| Oracle® Coherence Java API Reference Release 3.6.1.0 E18814-01
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

## com.tangosol.io.pof
Class SimplePofContext

`java.lang.Object
com.tangosol.io.pof.SimplePofContext`

All Implemented Interfaces:
  PofContext, Serializer

      public class SimplePofContext

extends java.lang.Object
implements PofContext

Basic `PofContext` implementation.

Since:
  Coherence 3.2
Author:
  jh 2006.07.18
See Also:
  `PortableObjectSerializer`

Field Summary
`protected LongArray` | `m_laClass` A LongArray of user types, indexed by type identifier.
`protected LongArray` | `m_laSerializer` A LongArray of PofSerializer objects, indexed by type identifier.
`protected java.util.Map` | `m_mapTypeId` A Map that contains mappings from a registered user type into type identifier.

Constructor Summary
`SimplePofContext()` Create a new SimplePofContext.

Method Summary
`java.lang.Object` | `deserialize(ReadBuffer.BufferInput in)` Deserialize an object from a ReadBuffer by reading its state using the specified BufferInput object.
`java.lang.Class` | `getClass(int nTypeId)` Determine the class associated with the given user type identifier.
`java.lang.String` | `getClassName(int nTypeId)` Determine the name of the class associated with the given user type identifier.
`PofSerializer` | `getPofSerializer(int nTypeId)` Return a PofSerializer that can be used to serialize and deserialize an object of the specified user type to and from a POF stream.
`int` | `getUserTypeIdentifier(java.lang.Class clz)` Determine the user type identifier associated with the given class.
`int` | `getUserTypeIdentifier(java.lang.Object o)` Determine the user type identifier associated with the given object.
`int` | `getUserTypeIdentifier(java.lang.String sClass)` Determine the user type identifier associated with the given class name.
`boolean` | `isUserType(java.lang.Class clz)` Determine if the given class is a user type known to this PofContext.
`boolean` | `isUserType(java.lang.Object o)` Determine if the given object is of a user type known to this PofContext.
`boolean` | `isUserType(java.lang.String sClass)` Determine if the class with the given name is a user type known to this PofContext.
`void` | `registerUserType(int nTypeId, java.lang.Class clz, PofSerializer serializer)` Associate a user type with a type identifier and `PofSerializer`.
`void` | `serialize(WriteBuffer.BufferOutput out, java.lang.Object o)` Serialize an object to a WriteBuffer by writing its state using the specified BufferOutput object.
`void` | `unregisterUserType(int nTypeId)` Unregister a user type that was previously registered using the specified type identifier.
`protected void` | `validateTypeId(int nTypeId)` Ensure that the given user type identifier is valid.

Field Detail

### m_mapTypeId

    protected java.util.Map m_mapTypeId

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

### m_laClass

    protected LongArray m_laClass

  A LongArray of user types, indexed by type identifier.

### m_laSerializer

    protected LongArray m_laSerializer

  A LongArray of PofSerializer objects, indexed by type identifier.

Constructor Detail

### SimplePofContext

    public SimplePofContext()

  Create a new SimplePofContext.

Method Detail

### serialize

    public void serialize(WriteBuffer.BufferOutput out,
                          java.lang.Object o)
                   throws java.io.IOException

  Serialize an object to a WriteBuffer by writing its state using the specified BufferOutput object.
  Specified by:
    `serialize` in interface `Serializer`
  Parameters:
    `out` - the BufferOutput with which to write the object's state
    `o` - the object to serialize
  Throws:
    `java.io.IOException` - if an I/O error occurs

### deserialize

    public java.lang.Object deserialize(ReadBuffer.BufferInput in)
                                 throws java.io.IOException

  Deserialize an object from a ReadBuffer by reading its state using the specified BufferInput object.
  Specified by:
    `deserialize` in interface `Serializer`
  Parameters:
    `in` - the BufferInput with which to read the object's state
  Returns:
    the deserialized user type instance
  Throws:
    `java.io.IOException` - if an I/O error occurs

### getPofSerializer

    public PofSerializer getPofSerializer(int nTypeId)

  Return a PofSerializer that can be used to serialize and deserialize an object of the specified user type to and from a POF stream.
  Specified by:
    `getPofSerializer` in interface `PofContext`
  Parameters:
    `nTypeId` - the type identifier of the user type that can be serialized and deserialized using the returned PofSerializer; must be non-negative
  Returns:
    a PofSerializer for the specified user type

### getUserTypeIdentifier

    public int getUserTypeIdentifier(java.lang.Object o)

  Determine the user type identifier associated with the given object.
  Specified by:
    `getUserTypeIdentifier` in interface `PofContext`
  Parameters:
    `o` - an instance of a user type; must not be null
  Returns:
    the type identifier of the user type associated with the given object

### getUserTypeIdentifier

    public int getUserTypeIdentifier(java.lang.Class clz)

  Determine the user type identifier associated with the given class.
  Specified by:
    `getUserTypeIdentifier` in interface `PofContext`
  Parameters:
    `clz` - a user type class; must not be null
  Returns:
    the type identifier of the user type associated with the given class

### getUserTypeIdentifier

    public int getUserTypeIdentifier(java.lang.String sClass)

  Determine the user type identifier associated with the given class name.
  Specified by:
    `getUserTypeIdentifier` in interface `PofContext`
  Parameters:
    `sClass` - the name of a user type class; must not be null
  Returns:
    the type identifier of the user type associated with the given class name

### getClassName

    public java.lang.String getClassName(int nTypeId)

  Determine the name of the class associated with the given user type identifier.
  Specified by:
    `getClassName` in interface `PofContext`
  Parameters:
    `nTypeId` - the user type identifier; must be non-negative
  Returns:
    the name of the class associated with the specified user type identifier

### getClass

    public java.lang.Class getClass(int nTypeId)

  Determine the class associated with the given user type identifier.
  Specified by:
    `getClass` in interface `PofContext`
  Parameters:
    `nTypeId` - the user type identifier; must be non-negative
  Returns:
    the class associated with the specified user type identifier

### isUserType

    public boolean isUserType(java.lang.Object o)

  Determine if the given object is of a user type known to this PofContext.
  Specified by:
    `isUserType` in interface `PofContext`
  Parameters:
    `o` - the object to test; must not be null
  Returns:
    true iff the specified object is of a valid user type

### isUserType

    public boolean isUserType(java.lang.Class clz)

  Determine if the given class is a user type known to this PofContext.
  Specified by:
    `isUserType` in interface `PofContext`
  Parameters:
    `clz` - the class to test; must not be null
  Returns:
    true iff the specified class is a valid user type

### isUserType

    public boolean isUserType(java.lang.String sClass)

  Determine if the class with the given name is a user type known to this PofContext.
  Specified by:
    `isUserType` in interface `PofContext`
  Parameters:
    `sClass` - the name of the class to test; must not be null
  Returns:
    true iff the class with the specified name is a valid user type

### registerUserType

    public void registerUserType(int nTypeId,
                                 java.lang.Class clz,
                                 PofSerializer serializer)

  Associate a user type with a type identifier and `PofSerializer`.
  Parameters:
    `nTypeId` - the type identifier of the specified user type; must be greater or equal to 0
    `clz` - the user type to register with this PofContext; must not be null
    `serializer` - the PofSerializer that will be used to serialize and deserialize objects of the specified class; must not be null
  Throws:
    `java.lang.IllegalArgumentException` - on invalid type identifer, class, or PofSerializer

### unregisterUserType

    public void unregisterUserType(int nTypeId)

  Unregister a user type that was previously registered using the specified type identifier.
  Parameters:
    `nTypeId` - the type identifier of the user type to unregister
  Throws:
    `java.lang.IllegalArgumentException` - if the specified user type identifier is unknown to this PofContext

### validateTypeId

    protected void validateTypeId(int nTypeId)

  Ensure that the given user type identifier is valid.
  Parameters:
    `nTypeId` - the user type identifier to validate
  Throws:
    `java.lang.IllegalArgumentException` - if the given user type identifier is negative

Skip navigation links

Overview | Package | Class | Tree | Index | Help
| Oracle® Coherence Java API Reference Release 3.6.1.0 E18814-01
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

Copyright © 2000, 2010, Oracle and/or its affiliates. All rights reserved.