Skip navigation links

Oracle® Coherence Java API Reference
Release 12.1.2.0.3

E26043-02


com.tangosol.util.comparator
Class ExtractorComparator

java.lang.Object
  extended by com.tangosol.util.comparator.ExtractorComparator

All Implemented Interfaces:
PortableObject, java.io.Serializable, java.util.Comparator

public class ExtractorComparator
extends java.lang.Object
implements java.util.Comparator, java.io.Serializable, PortableObject

Comparator implementation that uses specified ValueExtractor to extract value(s) to be used for comparison.

Author:
as 2010.09.09

Constructor Summary
ExtractorComparator()
          Default constructor (for PortableObject).
ExtractorComparator(ValueExtractor extractor)
          Construct a ExtractorComparator with the specified extractor.

 

Method Summary
 int compare(java.lang.Object o1, java.lang.Object o2)
          Compares extracted values (by specified ValueExtractor) of given arguments for order.
 void readExternal(PofReader in)
          Restore the contents of a user type instance by reading its state using the specified PofReader object.
 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 interface java.util.Comparator
equals

 

Constructor Detail

ExtractorComparator

public ExtractorComparator()
Default constructor (for PortableObject).

ExtractorComparator

public ExtractorComparator(ValueExtractor extractor)
Construct a ExtractorComparator with the specified extractor.
Parameters:
extractor - the ValueExtractor to use by this filter

Method Detail

compare

public int compare(java.lang.Object o1,
                   java.lang.Object o2)
Compares extracted values (by specified ValueExtractor) of given arguments for order.
Specified by:
compare in interface java.util.Comparator
Parameters:
o1 - the first object to be compared
o2 - the second object to be compared
Returns:
a negative integer, zero, or a positive integer as the first argument is less than, equal to, or greater than the second
Throws:
java.lang.ClassCastException - if the arguments' types prevent them from being compared by this Comparator.

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

Skip navigation links

Oracle® Coherence Java API Reference
Release 12.1.2.0.3

E26043-02


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