ValueExtractor Class Reference

#include <coherence/util/ValueExtractor.hpp>

Inherits Object.

Inherited by AbstractExtractor [virtual], and NullImplementation::NullValueExtractor [virtual].

List of all members.


Detailed Description

ValueExtractor is used to both extract values (for example, for sorting or filtering) from an object, and to provide an identity for that extraction.

Important Note: all classes that implement the ValueExtractor interface must explicitly implement the Object::hashCode() and Object::equals methods in a way that is based solely on the object's serializable state.

Author:
jh 2008.02.26

Public Types

typedef spec::Handle Handle
 ValueExtractor Handle definition.
typedef spec::View View
 ValueExtractor View definition.
typedef spec::Holder Holder
 ValueExtractor Holder definition.

Public Member Functions

virtual Object::Holder extract (Object::Holder ohTarget) const =0
 Extract the value from the passed object.
virtual bool equals (Object::View v) const =0
 Compare the ValueExtractor with another object to determine equality.
virtual size32_t hashCode () const =0
 Determine a hash value for the ValueExtractor object according to the general Object::hashCode() contract.

Member Function Documentation

virtual Object::Holder extract ( Object::Holder  ohTarget  )  const [pure virtual]

Extract the value from the passed object.

The returned value may be NULL.

Parameters:
ohTarget an Object to retrieve the value from
Returns:
the extracted value; NULL is an acceptable value
Exceptions:
ClassCastException if this ValueExtractor is incompatible with the passed object to extract a value from and the implementation requires the passed object to be of a certain type
Exception if this ValueExtractor encounters an exception in the course of extracting the value
IllegalArgumentException if this ValueExtractor cannot handle the passed object for any other reason; an implementor should include a descriptive message

Implemented in AbstractExtractor, ChainedExtractor, ComparisonValueExtractor, EntryExtractor, IdentityExtractor, KeyExtractor, MultiExtractor, and ReflectionExtractor.

virtual bool equals ( Object::View  v  )  const [pure virtual]

Compare the ValueExtractor with another object to determine equality.

Two ValueExtractor objects, ve1 and ve2 are considered equal iff ve1->extract(v) equals ve2->extract(v) for all values of v.

Parameters:
v the reference object with which to compare
Returns:
true iff this ValueExtractor and the passed object are equivalent ValueExtractors

Implemented in AbstractCompositeExtractor, IdentityExtractor, KeyExtractor, and ReflectionExtractor.

virtual size32_t hashCode (  )  const [pure virtual]

Determine a hash value for the ValueExtractor object according to the general Object::hashCode() contract.

Returns:
an integer hash value for this ValueExtractor object

Reimplemented from Object.

Implemented in AbstractCompositeExtractor, IdentityExtractor, KeyExtractor, and ReflectionExtractor.


The documentation for this class was generated from the following file: Copyright (c) 2000-2008 Oracle. All rights reserved.