|
Oracle® Coherence Java API Reference v3.5 E14977-01 |
|||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||
java.lang.Objectcom.tangosol.util.Base
com.tangosol.util.BitHelper
com.tangosol.util.ExternalizableHelper
com.tangosol.util.extractor.AbstractExtractor
com.tangosol.util.extractor.AbstractCompositeExtractor
com.tangosol.util.extractor.ComparisonValueExtractor
public class ComparisonValueExtractor
A synthetic ValueExtractor that returns a result of comparison between two
values extracted from the same target. In a most general case, the extracted
value represents an Integer value calculated accordingly to the contract of
Comparable.compareTo(java.lang.Object) or Comparator.compare(java.lang.Object, java.lang.Object) methods. However,
in more specific cases, when the compared values are of common numeric type,
the ComparisonValueExtractor will return a numeric difference between those
values. The Java type of the comparing values will dictate the Java type of
the result.
ValueExtractor extractDiff = new ComparisonValueExtractor(
new ReflectionExtractor("getSellPrice"),
new ReflectionExtractor("getBuyPrice"));
Filter filter = new LessFilter(extractDiff, new Double(0.0));
Set entries = cache.entrySet(filter);
| Field Summary | |
|---|---|
protected java.util.Comparator |
m_comparator
An underlying Comparator object (optional). |
| Fields inherited from class com.tangosol.util.extractor.AbstractCompositeExtractor |
|---|
m_aExtractor |
| Fields inherited from class com.tangosol.util.extractor.AbstractExtractor |
|---|
KEY, m_nTarget, VALUE |
| Constructor Summary | |
|---|---|
ComparisonValueExtractor()
Default constructor (necessary for the ExternalizableLite interface). |
|
ComparisonValueExtractor(java.lang.String sMethod1,
java.lang.String sMethod2)
Constuct a ComparisonValueExtractor based on two method names. |
|
ComparisonValueExtractor(java.lang.String sMethod1,
java.lang.String sMethod2,
java.util.Comparator comp)
Constuct a ComparisonValueExtractor based on two method names and a Comparator object. |
|
ComparisonValueExtractor(ValueExtractor ve1,
ValueExtractor ve2)
Constuct a ComparisonValueExtractor based on two specified extractors. |
|
ComparisonValueExtractor(ValueExtractor ve1,
ValueExtractor ve2,
java.util.Comparator comp)
Constuct a ComparisonValueExtractor based on two specified extractors and a Comparator object. |
|
| Method Summary | |
|---|---|
java.lang.Object |
extract(java.lang.Object oTarget)
Extract the value from the passed object. The returned value may be null. For intrinsic types, the returned value is expected to be a standard wrapper type in the same manner that reflection works; for example, int would be returned as a java.lang.Integer. |
java.util.Comparator |
getComparator()
Return a Comparator used by this extractor. |
void |
readExternal(java.io.DataInput in)
Restore the contents of this object by loading the object's state from the passed DataInput object. |
void |
readExternal(PofReader in)
Restore the contents of a user type instance by reading its state using the specified PofReader object. |
void |
writeExternal(java.io.DataOutput out)
Save the contents of this object by storing the object's state into the passed DataOutput 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 class com.tangosol.util.extractor.AbstractCompositeExtractor |
|---|
equals, getExtractors, hashCode, toString |
| Methods inherited from class com.tangosol.util.extractor.AbstractExtractor |
|---|
compare, compareEntries, extractFromEntry |
| 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 |
| Field Detail |
|---|
protected java.util.Comparator m_comparator
| Constructor Detail |
|---|
public ComparisonValueExtractor()
public ComparisonValueExtractor(java.lang.String sMethod1,
java.lang.String sMethod2)
Comparable.
sMethod1 - the name of the first method to invoke via reflectionsMethod2 - the name of the second method to invoke via reflection
public ComparisonValueExtractor(java.lang.String sMethod1,
java.lang.String sMethod2,
java.util.Comparator comp)
sMethod1 - the name of the first method to invoke via reflectionsMethod2 - the name of the second method to invoke via reflectioncomp - the comparator used to compare the extracted values (optional)
public ComparisonValueExtractor(ValueExtractor ve1,
ValueExtractor ve2)
Comparable.
ve1 - the ValueExtractor for the first valueve2 - the ValueExtractor for the second value
public ComparisonValueExtractor(ValueExtractor ve1,
ValueExtractor ve2,
java.util.Comparator comp)
ve1 - the ValueExtractor for the first valueve2 - the ValueExtractor for the second valuecomp - the comparator used to compare the extracted values (optional)| Method Detail |
|---|
public java.util.Comparator getComparator()
public java.lang.Object extract(java.lang.Object oTarget)
extract in interface ValueExtractorextract in class AbstractExtractoroTarget - an Object to retrieve the value from
public void readExternal(java.io.DataInput in)
throws java.io.IOException
readExternal in interface ExternalizableLitereadExternal in class AbstractCompositeExtractorin - the DataInput stream to read data from in order to restore
the state of this object
java.io.IOException - if an I/O exception occurs
java.io.NotActiveException - if the object is not in its initial
state, and therefore cannot be deserialized into
public void writeExternal(java.io.DataOutput out)
throws java.io.IOException
writeExternal in interface ExternalizableLitewriteExternal in class AbstractCompositeExtractorout - the DataOutput stream to write the state of this object to
java.io.IOException - if an I/O exception occurs
public void readExternal(PofReader in)
throws java.io.IOException
readExternal in interface PortableObjectreadExternal in class AbstractCompositeExtractorin - the PofReader from which to read the object's state
java.io.IOException - if an I/O error occurs
public void writeExternal(PofWriter out)
throws java.io.IOException
writeExternal in interface PortableObjectwriteExternal in class AbstractCompositeExtractorout - the PofWriter to which to write the object's state
java.io.IOException - if an I/O error occurs
|
Oracle® Coherence Java API Reference v3.5 E14977-01 |
|||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||