Overview | Package | Class | Tree | Index | Help

Oracle® Coherence Java API Reference
v3.5.3
E15583-01
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

## com.tangosol.util.extractor
Class MultiExtractor

    java.lang.Object
      com.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.MultiExtractor

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

    public class MultiExtractor

extends AbstractCompositeExtractor

Composite ValueExtractor implementation based on an array of extractors. All extractors in the array are applied to the same target object and the result of the extraction is a `List` of extracted values.

Common scenarios for using the MultiExtractor involve the `DistinctValues` or `GroupAggregator` aggregators, that allow clients to collect all distinct combinations of a given set of attributes or collect and run additional aggregation against the corresponding groups of entries.

Since:
  Coherence 3.2
Author:
  gg 2006.02.08

Field Summary

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
`MultiExtractor()` Default constructor (necessary for the ExternalizableLite interface).
`MultiExtractor(java.lang.String sNames)` Construct a MultiExtractor for a specified method name list.
`MultiExtractor(ValueExtractor[] aExtractor)` Construct a MultiExtractor.

Method Summary
`int` | `compareEntries(QueryMap.Entry entry1, QueryMap.Entry entry2)` Compare two entries based on the rules specified by `Comparator`. If possible, use the `extract` method to optimize the value extraction process. This method is expected to be implemented by Comparator wrappers, such as `ChainedComparator` and `InverseComparator`, which simply pass on this invocation to the wrapped Comparator objects if they too implement this interface, or to invoke their default compare method passing the actual objects (not the extracted values) obtained from the extractor using the passed entries.

This interface is also expected to be implemented by ValueExtractor implementations that implement the Comparator interface. It is expected that in most cases, the Comparator wrappers will eventually terminate at (i.e. delegate to) ValueExtractors that also implement this interface.
`static ValueExtractor[]` | `createExtractors(java.lang.String sNames)` Parse a comma-delimited sequence of method names and instantiate a corresponding array of `ValueExtractor` objects.
`java.lang.Object` | `extract(java.lang.Object oTarget)` Extract a collection of values from the passed object using the underlying array of ValueExtractor objects.
`java.lang.Object` | `extractFromEntry(java.util.Map.Entry entry)` Extract a collection of values from the passed entry using the underlying array of ValueExtractor objects.

Methods inherited from class com.tangosol.util.extractor.AbstractCompositeExtractor
`equals, getExtractors, hashCode, readExternal, readExternal, toString, writeExternal, writeExternal`

Methods inherited from class com.tangosol.util.extractor.AbstractExtractor
`compare`

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

### MultiExtractor

    public MultiExtractor()

  Default constructor (necessary for the ExternalizableLite interface).

### MultiExtractor

    public MultiExtractor(ValueExtractor[] aExtractor)

  Construct a MultiExtractor.

  Parameters:
    `aExtractor` - the ValueExtractor array

### MultiExtractor

    public MultiExtractor(java.lang.String sNames)

  Construct a MultiExtractor for a specified method name list.

  Parameters:
    `sNames` - a comma-delimited sequence of method names which results in a MultiExtractor that is based on a corresponding array of `ValueExtractor` objects; individual array elements will be either `ReflectionExtractor` or `ChainedExtractor` objects

Method Detail

### extract

    public java.lang.Object extract(java.lang.Object oTarget)

  Extract a collection of values from the passed object using the underlying array of ValueExtractor objects. Note that each individual value could be an object of a standard wrapper type (for intrinsic types) or null.

  Specified by:
    `extract` in interface `ValueExtractor`
  Overrides:
    `extract` in class `AbstractExtractor`
  Parameters:
    `oTarget` - an Object to retrieve the collection of values from
  Returns:
    a `List` containing the extracted values or null if the target object itself is null

### extractFromEntry

    public java.lang.Object extractFromEntry(java.util.Map.Entry entry)

  Extract a collection of values from the passed entry using the underlying array of ValueExtractor objects. Note that each individual value could be an object of a standard wrapper type (for intrinsic types) or null.

  Overrides:
    `extractFromEntry` in class `AbstractExtractor`
  Parameters:
    `entry` - an entry to retrieve the collection of values from
  Returns:
    a `List` containing the extracted values

### compareEntries

    public int compareEntries(QueryMap.Entry entry1,
                              QueryMap.Entry entry2)

  Compare two entries based on the rules specified by `Comparator`.

  If possible, use the `extract` method to optimize the value extraction process.

  This method is expected to be implemented by Comparator wrappers, such as `ChainedComparator` and `InverseComparator`, which simply pass on this invocation to the wrapped Comparator objects if they too implement this interface, or to invoke their default compare method passing the actual objects (not the extracted values) obtained from the extractor using the passed entries.

  This interface is also expected to be implemented by ValueExtractor implementations that implement the Comparator interface. It is expected that in most cases, the Comparator wrappers will eventually terminate at (i.e. delegate to) ValueExtractors that also implement this interface.

  Specified by:
    `compareEntries` in interface `QueryMapComparator`
  Overrides:
    `compareEntries` in class `AbstractExtractor`
  Parameters:
    `entry1` - the first entry to compare values from; read-only
    `entry2` - the second entry to compare values from; read-only
  Returns:
    a negative integer, zero, or a positive integer as the first entry denotes a value that is is less than, equal to, or greater than the value denoted by the second entry

### createExtractors

    public static ValueExtractor[] createExtractors(java.lang.String sNames)

  Parse a comma-delimited sequence of method names and instantiate a corresponding array of `ValueExtractor` objects. Individual array elements will be either `ReflectionExtractor` or `ChainedExtractor` objects.

  Parameters:
    `sNames` - a comma-delimited sequence of method names
  Returns:
    an array of `ValueExtractor` objects

Overview | Package | Class | Tree | Index | Help

Oracle® Coherence Java API Reference
v3.5.3
E15583-01
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

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