CoherenceTM v3.3
Copyright© 2000-2007 by Oracle Corporation

com.tangosol.util.extractor
Class ChainedExtractor

java.lang.Object
  extended by com.tangosol.util.Base
      extended by com.tangosol.util.extractor.AbstractExtractor
          extended by com.tangosol.util.extractor.AbstractCompositeExtractor
              extended by com.tangosol.util.extractor.ChainedExtractor
All Implemented Interfaces:
ExternalizableLite, PortableObject, QueryMapComparator, ValueExtractor, Serializable, Comparator

public class ChainedExtractor
extends AbstractCompositeExtractor

Composite ValueExtractor implementation based on an array of extractors. The extractors in the array are applied sequentially left-to-right, so a result of a previous extractor serves as a target object for a next one.

Author:
gg 2003.09.22

Field Summary
 
Fields inherited from class com.tangosol.util.extractor.AbstractCompositeExtractor
m_aExtractor
 
Constructor Summary
ChainedExtractor()
          Default constructor (necessary for the ExternalizableLite interface).
ChainedExtractor(String sName)
          Construct a ChainedExtractor for a specified method name sequence.
ChainedExtractor(ValueExtractor[] aExtractor)
          Construct a ChainedExtractor based on a specified ValueExractor array.
ChainedExtractor(ValueExtractor extractor1, ValueExtractor extractor2)
          Construct a ChainedExtractor based on two extractors.
 
Method Summary
static ValueExtractor[] createExtractors(String sName)
          Parse a dot-delimited sequence of method names and instantiate a corresponding array of ReflectionExtractor objects.
 Object extract(Object oTarget)
          Extract the value from the passed object.
 
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, compareEntries
 

Constructor Detail

ChainedExtractor

public ChainedExtractor()
Default constructor (necessary for the ExternalizableLite interface).


ChainedExtractor

public ChainedExtractor(ValueExtractor[] aExtractor)
Construct a ChainedExtractor based on a specified ValueExractor array.

Parameters:
aExtractor - the ValueExtractor array

ChainedExtractor

public ChainedExtractor(ValueExtractor extractor1,
                        ValueExtractor extractor2)
Construct a ChainedExtractor based on two extractors.

Parameters:
extractor1 - the ValueExtractor
extractor2 - the ValueExtractor

ChainedExtractor

public ChainedExtractor(String sName)
Construct a ChainedExtractor for a specified method name sequence.

Parameters:
sName - a dot-delimited sequence of method names which results in a ChainedExtractor that is based on an array of corresponding ReflectionExtractor objects
Method Detail

extract

public Object extract(Object oTarget)
Extract the value from the passed object. The underlying extractors are applied sequentially, so a result of a previous extractor serves as a target object for a next one. A value of null prevents any further extractions and is returned immediately. 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.

Specified by:
extract in interface ValueExtractor
Specified by:
extract in class AbstractExtractor
Parameters:
oTarget - an Object to retrieve the value from
Returns:
the extracted value as an Object; null is an acceptable value

createExtractors

public static ValueExtractor[] createExtractors(String sName)
Parse a dot-delimited sequence of method names and instantiate a corresponding array of ReflectionExtractor objects.

Parameters:
sName - a dot-delimited sequence of method names
Returns:
an array of ReflectionExtractor objects

CoherenceTM v3.3
Copyright© 2000-2007 by Oracle Corporation