Class PofExtractor
POF-based IValueExtractor implementation. PofExtractor takes advantage of POF's indexed state to extract part of an object without needing to deserialize the entire object.
Inherited Members
Namespace: Tangosol.Util.Extractor
Assembly: Coherence.dll
Syntax
[Serializable]
public class PofExtractor : AbstractExtractor, IValueExtractor, IQueryCacheComparer, IComparer, IPortableObject
Remarks
POF uses a compact form in the serialized value when possible. For
example, some numeric values are represented as special POF intrinsic
types in which the type implies the value. As a result, POF requires
the receiver of a value to have implicit knowledge of the type.
PofExtractor uses the type supplied in the constructor as the source
of the type information. If the type is null
, PofExtractor
will infer the type from the serialized state.
Example where extracted value is Double:
IValueExtractor extractor = new PofExtractor(typeof(Double), 2);
Example where extracted value should be inferred:
IValueExtractor extractor = new PofExtractor(null, 2);
Constructors
PofExtractor()
Default constructor.
Declaration
public PofExtractor()
PofExtractor(Type, int)
Constructs a PofExtractor based on a property index.
Declaration
public PofExtractor(Type type, int index)
Parameters
Type | Name | Description |
---|---|---|
Type | type | The required type of the extracted value or |
int | index | Property index. |
Remarks
This constructor is equivalent to:
PofExtractor extractor =
new PofExtractor(type, new SimplePofPath(index), VALUE);
PofExtractor(Type, IPofNavigator)
Constructs a PofExtractor based on a POF navigator.
Declaration
public PofExtractor(Type type, IPofNavigator navigator)
Parameters
Type | Name | Description |
---|---|---|
Type | type | The required type of the extracted value or |
IPofNavigator | navigator | POF navigator. |
PofExtractor(Type, IPofNavigator, int)
Constructs a PofExtractor based on a POF navigator and the entry extraction target.
Declaration
public PofExtractor(Type type, IPofNavigator navigator, int target)
Parameters
Type | Name | Description |
---|---|---|
Type | type | The required type of the extracted value or |
IPofNavigator | navigator | POF navigator. |
int | target |
Properties
Navigator
Obtain the IPofNavigator for this extractor.
Declaration
public IPofNavigator Navigator { get; }
Property Value
Type | Description |
---|---|
IPofNavigator |
TypeExtracted
Obtain the type of the extracted value.
Declaration
public Type TypeExtracted { get; }
Property Value
Type | Description |
---|---|
Type | The expected type. |
Methods
Equals(object)
Compare the PofExtractor with another object to determine equality.
Declaration
public override bool Equals(object o)
Parameters
Type | Name | Description |
---|---|---|
object | o | Object to compare with |
Returns
Type | Description |
---|---|
bool | true iff this PofExtractor and the passed object are equivalent |
Overrides
Remarks
Two PofExtractor objects are considered equal iff their paths are equal and they have the same target (key or value).
ExtractFromEntry(ICacheEntry)
Extracts the value from the passed ICacheEntry object.
Declaration
public override object ExtractFromEntry(ICacheEntry entry)
Parameters
Type | Name | Description |
---|---|---|
ICacheEntry | entry | An Entry object to extract a value from |
Returns
Type | Description |
---|---|
object | The extracted value |
Overrides
Remarks
This method will always throw a NotSupportedException if called directly by the .NET client application, as its execution is only meaningful within the cluster.
It is expected that this extractor will only be used against POF-encoded binary entries within a remote partitioned cache.Exceptions
Type | Condition |
---|---|
NotSupportedException | Always, as it is expected that this extractor will only be executed within the cluster. |
GetHashCode()
Determine a hash value for the PofExtractor object.
Declaration
public override int GetHashCode()
Returns
Type | Description |
---|---|
int | An integer hash value for this PofExtractor object |
Overrides
GetPofTypeId(IPofContext)
Compute the expected pof type id based on the type.
Declaration
protected int GetPofTypeId(IPofContext ctx)
Parameters
Type | Name | Description |
---|---|---|
IPofContext | ctx | Pof context. |
Returns
Type | Description |
---|---|
int | Pof type id or T_UNKNOWN if the type
is |
ReadExternal(IPofReader)
Restore the contents of a user type instance by reading its state using the specified IPofReader object.
Declaration
public void ReadExternal(IPofReader reader)
Parameters
Type | Name | Description |
---|---|---|
IPofReader | reader | The IPofReader from which to read the object's state. |
Exceptions
Type | Condition |
---|---|
IOException | If an I/O error occurs. |
ToString()
Return a human-readable description for this PofExtractor.
Declaration
public override string ToString()
Returns
Type | Description |
---|---|
string | String description of the PofExtractor |
Overrides
WriteExternal(IPofWriter)
Save the contents of a POF user type instance by writing its state using the specified IPofWriter object.
Declaration
public void WriteExternal(IPofWriter writer)
Parameters
Type | Name | Description |
---|---|---|
IPofWriter | writer | The IPofWriter to which to write the object's state. |
Exceptions
Type | Condition |
---|---|
IOException | If an I/O error occurs. |