Oracle® Coherence Java API Reference
v3.5

E14977-01

com.tangosol.util.extractor
Class PofExtractor

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.util.extractor.AbstractExtractor
                  extended by com.tangosol.util.extractor.PofExtractor
All Implemented Interfaces:
PortableObject, QueryMapComparator, ValueExtractor, java.io.Serializable, java.util.Comparator

public class PofExtractor
extends AbstractExtractor
implements PortableObject

POF-based ValueExtractor implementation.

Since:
Coherence 3.5
Author:
as 2009.02.14

Field Summary
 
Fields inherited from class com.tangosol.util.extractor.AbstractExtractor
KEY, m_nTarget, VALUE
 
Constructor Summary
PofExtractor()
          Default constructor (necessary for the PortableObject interface).
PofExtractor(int iProp)
          Constructs a PofExtractor based on a property index.
PofExtractor(PofNavigator navigator)
          Constructs a PofExtractor based on a POF navigator.
PofExtractor(PofNavigator navigator, int nTarget)
          Constructs a PofExtractor based on a POF navigator and the entry extraction target.
 
Method Summary
 boolean equals(java.lang.Object o)
          Compare the PofExtractor with another object to determine equality.
 java.lang.Object extractFromEntry(java.util.Map.Entry entry)
          Extracts the value from the passed Entry object.
 PofNavigator getNavigator()
          Obtain the POF navigator for this extractor.
 int hashCode()
          Determine a hash value for the PofExtractor object according to the general Object.hashCode() contract.
 void readExternal(PofReader in)
          Restore the contents of a user type instance by reading its state using the specified PofReader object.
 java.lang.String toString()
          Return a human-readable description for this PofExtractor.
 void writeExternal(PofWriter out)
          Save the contents of a POF user type instance by writing its state using the specified PofWriter object.
 
Methods inherited from class com.tangosol.util.extractor.AbstractExtractor
compare, compareEntries, extract
 
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
 

Constructor Detail

PofExtractor

public PofExtractor()
Default constructor (necessary for the PortableObject interface).


PofExtractor

public PofExtractor(int iProp)
Constructs a PofExtractor based on a property index.

This constructor is equivalent to:

   PofExtractor extractor =
       new PofExtractor(new SimplePofPath(iProp), VALUE);
 

Parameters:
iProp - property index

PofExtractor

public PofExtractor(PofNavigator navigator)
Constructs a PofExtractor based on a POF navigator.

Parameters:
navigator - POF navigator

PofExtractor

public PofExtractor(PofNavigator navigator,
                    int nTarget)
Constructs a PofExtractor based on a POF navigator and the entry extraction target.

Parameters:
navigator - POF navigator
nTarget - one of the AbstractExtractor.VALUE or AbstractExtractor.KEY values
Method Detail

extractFromEntry

public java.lang.Object extractFromEntry(java.util.Map.Entry entry)
Extracts the value from the passed Entry object.

It is expected that this extractor will only be used against POF-encoded entries implementing BinaryEntry interface.

Overrides:
extractFromEntry in class AbstractExtractor
Parameters:
entry - an Entry object to extract a value from
Returns:
the extracted value
Throws:
java.lang.UnsupportedOperationException - if the specified Entry is not a POF-encoded BinaryEntry or the serializer is not a PofContext

getNavigator

public PofNavigator getNavigator()
Obtain the POF navigator for this extractor.

Returns:
the POF navigator

equals

public boolean equals(java.lang.Object o)
Compare the PofExtractor with another object to determine equality. Two PofExtractor objects are considered equal iff their navigators are equal and they have the same target (key or value).

Specified by:
equals in interface ValueExtractor
Specified by:
equals in interface java.util.Comparator
Parameters:
o - the reference object with which to compare
Returns:
true iff this PofExtractor and the passed object are equivalent

hashCode

public int hashCode()
Determine a hash value for the PofExtractor object according to the general Object.hashCode() contract.

Specified by:
hashCode in interface ValueExtractor
Returns:
an integer hash value for this PofExtractor object

toString

public java.lang.String toString()
Return a human-readable description for this PofExtractor.

Specified by:
toString in interface ValueExtractor
Returns:
a String description of the PofExtractor

readExternal

public void readExternal(PofReader in)
                  throws java.io.IOException
Restore the contents of a user type instance by reading its state using the specified PofReader object.

Specified by:
readExternal in interface PortableObject
Parameters:
in - the PofReader from which to read the object's state
Throws:
java.io.IOException - if an I/O error occurs

writeExternal

public void writeExternal(PofWriter out)
                   throws java.io.IOException
Save the contents of a POF user type instance by writing its state using the specified PofWriter object.

Specified by:
writeExternal in interface PortableObject
Parameters:
out - the PofWriter to which to write the object's state
Throws:
java.io.IOException - if an I/O error occurs

Oracle® Coherence Java API Reference
v3.5

E14977-01

Copyright © 2000, 2009, Oracle. All rights reserved.