Skip navigation links

Oracle® Coherence Java API Reference
Release 3.6.0.0

E15725-01


com.tangosol.io.pof.reflect
Class AbstractPofValue

java.lang.Object
  extended by com.tangosol.util.Base
      extended by com.tangosol.util.BitHelper
          extended by com.tangosol.util.ExternalizableHelper
              extended by com.tangosol.io.pof.reflect.AbstractPofValue

All Implemented Interfaces:
PofValue
Direct Known Subclasses:
ComplexPofValue, SimplePofValue

public abstract class AbstractPofValue
extends ExternalizableHelper
implements PofValue

An abstract base class that implements common functionality for all PofValue types.

Since:
Coherence 3.5
Author:
as 2009.02.12

Field Summary
protected  int m_nType
          POF type identifer of this value.
protected  Object m_oValue
          Deserialized representation of this value.

 

Constructor Summary
AbstractPofValue(PofValue valueParent, ReadBuffer bufValue, PofContext ctx, int of, int nType)
          Construct a PofValue instance wrapping the supplied buffer.

 

Method Summary
 Binary applyChanges()
          Apply all the changes that were made to this value and return a binary representation of the new value.
 ReadBuffer getChanges()
          Return a buffer containing changes made to this PofValue in the format defined by the BinaryDeltaCompressor.
protected  int getDirtyBytesCount()
          Get the estimated number of dirty bytes in this POF value hierarchy.
 int getOffset()
          Return the offset of this value from the beginning of POF stream.
protected  ReadBuffer getOriginalBuffer()
          Get the original buffer the changes should be applied to.
 PofValue getParent()
          Return the parent of this value.
 PofContext getPofContext()
          Return the POF context to use for serialization and deserialization.
protected  int getPropertyIndex()
           
 PofValue getRoot()
          Return the root of the hierarchy this value belongs to.
 ReadBuffer getSerializedValue()
          Return this value's serialized form.
 int getSize()
          Return the size of the encoded value in bytes.
 int getTypeId()
          Obtain the POF type identifier for this value.
 Object getValue()
          Return the deserialized value which this PofValue represents.
 Object getValue(Class clz)
          Return the deserialized value which this PofValue represents.
 Object getValue(int nType)
          Return the deserialized value which this PofValue represents.
protected  ReadBuffer getValueBuffer()
          Get the raw value buffer.
protected  void incrementDirtyBytesCount(int cb)
          Increment the counter representing the estimated number of bytes in the original buffer that have been modified.
protected  void incrementDirtyValuesCount()
          Increment the counter representing the number of values within this POF hierarchy that have been modified.
 boolean isDirty()
          Return true if this value has been modified, false otherwise.
protected  boolean isRoot()
          Return true if this instance is the root of the PofValue hierarchy.
protected  boolean isUniformEncoded()
          Return true if the buffer contains only the value, without the type identifier.
protected  void setDecorations(byte nDecoMask, ReadBuffer bufDeco)
          Set the decoration mask and decorations for the PofValue.
protected  void setDirty()
          Set the dirty flag for this value.
protected  void setOriginalBuffer(ReadBuffer bufValue)
          Set the original buffer the changes should be applied to.
protected  void setUniformEncoded()
          Specifies that the buffer contains only a value, without a type identifier.
 void setValue(Object oValue)
          Update this PofValue.

 

Methods inherited from class com.tangosol.util.BitHelper
countBits, countBits, countBits, indexOfLSB, indexOfLSB, indexOfLSB, indexOfMSB, indexOfMSB, indexOfMSB, rotateLeft, rotateLeft, rotateLeft, rotateRight, rotateRight, rotateRight, toBitString, toBitString, toBitString

 

Methods inherited from interface com.tangosol.io.pof.reflect.PofValue
getChild

 

Field Detail

m_nType

protected int m_nType
POF type identifer of this value.

m_oValue

protected Object m_oValue
Deserialized representation of this value.

Constructor Detail

AbstractPofValue

public AbstractPofValue(PofValue valueParent,
                        ReadBuffer bufValue,
                        PofContext ctx,
                        int of,
                        int nType)
Construct a PofValue instance wrapping the supplied buffer.
Parameters:
valueParent - parent value within the POF stream
bufValue - buffer containing POF representation of this value
ctx - POF context to use when reading or writing properties
of - offset of this value from the beginning of POF stream
nType - POF type identifier for this value

Method Detail

getTypeId

public int getTypeId()
Obtain the POF type identifier for this value.
Specified by:
getTypeId in interface PofValue
Returns:
POF type identifier for this value

getRoot

public PofValue getRoot()
Return the root of the hierarchy this value belongs to.
Specified by:
getRoot in interface PofValue
Returns:
the root value

getParent

public PofValue getParent()
Return the parent of this value.
Specified by:
getParent in interface PofValue
Returns:
the parent value, or null if this is root value

getValue

public Object getValue()
Return the deserialized value which this PofValue represents.
Specified by:
getValue in interface PofValue
Returns:
the deserialized value

getValue

public Object getValue(Class clz)
Return the deserialized value which this PofValue represents.
Specified by:
getValue in interface PofValue
Parameters:
clz - the required class of the returned value or null if the class is to be inferred from the serialized state
Returns:
the deserialized value

getValue

public Object getValue(int nType)
Return the deserialized value which this PofValue represents.
Specified by:
getValue in interface PofValue
Parameters:
nType - the required Pof type of the returned value or PofConstants.T_UNKNOWN if the type is to be inferred from the serialized state
Returns:
the deserialized value

setValue

public void setValue(Object oValue)
Update this PofValue. <p/> The changes made using this method will be immediately reflected in the result of PofValue.getValue() method, but will not be applied to the underlying POF stream until the PofValue.applyChanges() method is invoked on the root PofValue.
Specified by:
setValue in interface PofValue
Parameters:
oValue - new deserialized value for this PofValue

applyChanges

public Binary applyChanges()
Apply all the changes that were made to this value and return a binary representation of the new value. <p/> Any format prefixes and/or decorations that were present in the original buffer this value orginated from will be preserved. <p/> Note: this method can only be called on the root PofValue.
Specified by:
applyChanges in interface PofValue
Returns:
new Binary object that contains modified PofValue

getChanges

public ReadBuffer getChanges()
Return a buffer containing changes made to this PofValue in the format defined by the BinaryDeltaCompressor. <p/> Note: this method can only be called on the root PofValue
Specified by:
getChanges in interface PofValue
Returns:
a buffer containing changes made to this PofValue

getPofContext

public PofContext getPofContext()
Return the POF context to use for serialization and deserialization.
Returns:
the POF context

getOffset

public int getOffset()
Return the offset of this value from the beginning of POF stream.
Returns:
the offset of this value from the beginning of POF stream

getSize

public int getSize()
Return the size of the encoded value in bytes.
Returns:
the size of the encoded value

isDirty

public boolean isDirty()
Return true if this value has been modified, false otherwise.
Returns:
true if this value has been modified, false otherwise

setDirty

protected void setDirty()
Set the dirty flag for this value.

getSerializedValue

public ReadBuffer getSerializedValue()
Return this value's serialized form.
Returns:
this value's serialized form

getPropertyIndex

protected int getPropertyIndex()

getOriginalBuffer

protected ReadBuffer getOriginalBuffer()
Get the original buffer the changes should be applied to.
Returns:
buffer containing the original value

setOriginalBuffer

protected void setOriginalBuffer(ReadBuffer bufValue)
Set the original buffer the changes should be applied to.
Parameters:
bufValue - buffer containing the original value

getValueBuffer

protected ReadBuffer getValueBuffer()
Get the raw value buffer.
Returns:
buffer containing the raw value

setDecorations

protected void setDecorations(byte nDecoMask,
                              ReadBuffer bufDeco)
Set the decoration mask and decorations for the PofValue.
Parameters:
nDecoMask - decoration identifiers bit mask
bufDeco - buffer containing the decorations

isRoot

protected boolean isRoot()
Return true if this instance is the root of the PofValue hierarchy.
Returns:
true if this is the root value

isUniformEncoded

protected boolean isUniformEncoded()
Return true if the buffer contains only the value, without the type identifier.
Returns:
true if the buffer contains only the value

setUniformEncoded

protected void setUniformEncoded()
Specifies that the buffer contains only a value, without a type identifier.

getDirtyBytesCount

protected int getDirtyBytesCount()
Get the estimated number of dirty bytes in this POF value hierarchy.
Returns:
the number of dirty bytes

incrementDirtyValuesCount

protected void incrementDirtyValuesCount()
Increment the counter representing the number of values within this POF hierarchy that have been modified.

incrementDirtyBytesCount

protected void incrementDirtyBytesCount(int cb)
Increment the counter representing the estimated number of bytes in the original buffer that have been modified.
Parameters:
cb - the number of bytes to increment counter for

Skip navigation links

Oracle® Coherence Java API Reference
Release 3.6.0.0

E15725-01


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