IBM WebSphereTM eXtreme Scale, Release 8.6
API Specification

com.ibm.websphere.objectgrid.continuousquery.filter
Class CompareFilter<KeyType,ValueType,AttributeType,MatchType>

java.lang.Object
  extended by com.ibm.websphere.objectgrid.continuousquery.filter.AbstractCQFilter<KeyType,ValueType,AttributeType,MatchType>
      extended by com.ibm.websphere.objectgrid.continuousquery.filter.CompareFilter<KeyType,ValueType,AttributeType,MatchType>
Type Parameters:
KeyType - Type of the key object for the map being queried
ValueType - Type of the value object for the map being queried
AttributeType - Type of the attribute referenced by the attribute path
MatchType - Type of the object being compared to
All Implemented Interfaces:
ContinuousQueryFilter<KeyType,ValueType,AttributeType,MatchType>, Serializable
Direct Known Subclasses:
EQFilter, GTEFilter, GTFilter, LTEFilter, LTFilter, MatchFilter, NEQFilter, NotMatchFilter

public abstract class CompareFilter<KeyType,ValueType,AttributeType,MatchType>
extends AbstractCQFilter<KeyType,ValueType,AttributeType,MatchType>

This is a base class for filters comparing an attribute with a scalar.

Since:
8.6
See Also:
Serialized Form

Field Summary
protected  String attributePath
           
protected  MatchType objectToCompare
           
 
Fields inherited from class com.ibm.websphere.objectgrid.continuousquery.filter.AbstractCQFilter
version
 
Fields inherited from interface com.ibm.websphere.objectgrid.continuousquery.ContinuousQueryFilter
POJO_ADDRESSABLEKEYNAME, POJO_PATHSEPARATOR
 
Constructor Summary
CompareFilter()
           
CompareFilter(String attributePath, MatchType object)
          Construct a filter for comparing an arbitrary object with the filtering criteria.
 
Method Summary
protected  String createString(String operator)
          Composes a string representation of the compare filter using the operator.
 
Methods inherited from class com.ibm.websphere.objectgrid.continuousquery.filter.AbstractCQFilter
createString, equals, getAttribute, hashCode, isKeyFilter, toString, validateAttributePath
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
 
Methods inherited from interface com.ibm.websphere.objectgrid.continuousquery.ContinuousQueryFilter
filter
 

Field Detail

attributePath

protected String attributePath

objectToCompare

protected MatchType objectToCompare
Constructor Detail

CompareFilter

public CompareFilter()

CompareFilter

public CompareFilter(String attributePath,
                     MatchType object)
Construct a filter for comparing an arbitrary object with the filtering criteria. The attribute path format is dependent on how the associated BackingMap is configured:

POJO maps
For POJO maps which use traditional java serialization, or a custom ObjectTransformer, attributes are accessed using reflection. The field name and property name are defined by the JavaBeans specification, or the method name defined in the class. By default paths are assumed to reference attributes on the value object associated with the cache entry. The path delimiter is ".", which is specified in ContinuousQueryFilter.POJO_PATHSEPARATOR.

A key object attribute is specified by including the "key" path prefix, which is specified in ContinuousQueryFilter.POJO_ADDRESSABLEKEYNAME.

To specify a method invocation, append "()" to the method name.

If null or an empty string is specified, the entire value object is used as the attribute value.

If ContinuousQueryFilter.POJO_ADDRESSABLEKEYNAME is specified by itself, the entire key object is used as the attribute value.

POJO attribute path grammar:

 <attributePath> ::= NULL | "" | "key" | <repeatableSegment> | "key" <pathSeparator> <repeatableSegment>
 <repeatableSegment> ::= <segment> | <segment> <pathSeparator> <repeatableSegment> 
 <segment> ::= <attributeName> | <methodName> "()"
 <attributeName> ::= a valid field name on the POJO
 <methodName> ::= a no argument public method on the POJO
 
POJO attribute path examples:


MapSerializerPlugin maps
For maps that use a MapSerializerPlugin, the attribute path is passed directly to the DataSerializer.DataAttributeInflatable.getAttributeContexts(String...) method and the attribute values are fetched using the DataSerializer.DataAttributeInflatable.inflateDataObjectAttributes(DataObjectContext, XsDataInputStream, Object) method. The attribute path is a path to an attribute within the key or value.

A key attribute is specified by including the "key" path prefix, or the prefix specified by the MapDataDescriptor.getAddressableKeyName() method.

The path delimiter is specified in the DataDescriptor.getPathSeparator() for the DataDescriptor for each KeyDataSerializer or ValueSerializer.

If null or an empty string is specified, the entire value object is used as the attribute value.

If MapDataDescriptor.getAddressableKeyName() is specified by itself, the entire key object is used as the attribute value.

Serializer attribute path grammar:

 <attributePath> ::= NULL | "" | <addressableKeyName> | <repeatableSegment> | <addressableKeyName> <pathSeparator> <repeatableSegment>
 <repeatableSegment> ::= <attributeName> | <attributeName> <pathSeparator> <repeatableSegment> 
 <attributeName> ::= a valid field name on the POJO
 <addressableKeyName> ::= "key" or the key identifier defined in MapDataDescriptor.getAddressableKeyName() 
 <pathSeparator> ::= the path separator defined in DataDescriptor.getPathSeparator()
 
MapSerializerPlugin attribute path examples:
(assuming the default addressable key name of "key" and path separator of ".") Note: In this scenario all processing of the attribute path is dependent on the MapSerializerPlugin implementation. MapSerializerPlugin implementations can implement method invocation as part of the attribute path processing, but are not required to do so.


eXtreme Data Format maps
For maps using the eXtreme Data Format (XDF), the attribute path is passed directly to the XDF component which will extract the attribute. The attribute path is a path to an attribute within the key or value.

A key attribute is specified by including the "key" path prefix, or the prefix specified by the MapDataDescriptor.getAddressableKeyName() method.

The path delimiter is specified in the DataDescriptor.DEFAULT_PATHSEPARATOR.

If null or an empty string is specified, the entire value object is used as the attribute value.

If MapDataDescriptor.getAddressableKeyName() is specified by itself, the entire key object is used as the attribute value.

XDF attribute path grammar:

 <attributePath> ::= NULL | "" | <addressableKeyName> | <repeatableSegment> | <addressableKeyName> <pathSeparator> <repeatableSegment>
 <repeatableSegment> ::= <attributeName> | <attributeName> <pathSeparator> <repeatableSegment> 
 <attributeName> ::= a valid field name on the POJO
 <addressableKeyName> ::= "key" or the key identifier defined in MapDataDescriptor.getAddressableKeyName() 
 <pathSeparator> ::= the path separator defined in DataDescriptor.DEFAULT_PATHSEPARATOR
 
XDF attribute path examples:
(assuming the default addressable key name of "key" and path separator of ".") Note: method invocation is not supported when using Continuous Query with XDF maps. Continuous query does not support entity maps.

Parameters:
attributePath - The path for retrieving a value for the object to be filtered. If the value object should be compared without any manipulation, use null. If the key object should be compared without any manipulation, use the addressible key name.
object - The value to be compared with
Method Detail

createString

protected String createString(String operator)
Composes a string representation of the compare filter using the operator.

Parameters:
operator - the symbol that represents the operation
Returns:
" " where refers to the path for accessing a value from the object to be filtered refers to the input parameter, and refers to the string representation of the object to compare the filtering value with
IBM WebSphereTM eXtreme Scale, Release 8.6
API Specification

© Copyright International Business Machines Corp 2005,2012. All rights reserved.