Documentation Archive Developer
Search
PATH  Documentation > WebObjects 4.5 > EOControl Reference

Table of Contents

EOKeyValueQualifier


Inherits from:
(com.apple.client.eocontrol) EOQualifier : Object
(com.apple.yellow.eocontrol) EOQualifier : NSObject
Implements:
EOQualifierEvaluation
(com.apple.client.eocontrol only) NSCoding
Package:
com.apple.client.eocontrol
com.apple.yellow.eocontrol


Class Description


EOKeyValueQualifier is a subclass of EOQualifier that compares a named property of an object with a supplied value, for example, "salary > 1500". EOKeyValueQualifier implements the EOQualifierEvaluation interface, which defines the method evaluateWithObject for in-memory evaluation. When an EOKeyValueQualifier object receives an evaluateWithObject message, it evaluates the given object to determine if it satisfies the qualifier criteria.

In addition to performing in-memory filtering, EOKeyValueQualifier can be used to generate SQL. When it's used for this purpose, the key should be a valid property name of the root entity for the qualifier (or a valid key path).




Interfaces Implemented


EOQualifierEvaluation
evaluateWithObject
NSCoding (com.apple.client.eocontrol only)
classForCoder
encodeWithCoder


Constructors



EOKeyValueQualifier

public EOKeyValueQualifier( String key, NSSelector selector, Object value)

Creates and returns a new EOKeyValueQualifier.

If key, selector, and value are provided, the EOKeyValueQualifier compares values for key to value using the operator method selector. The possible values for selector are as follows:

Enterprise Objects Framework supports SQL generation for these methods only. You can generate SQL using the EOSQLExpression static method sqlStringForKeyValueQualifier.

For example, the following excerpt creates an EOKeyValueQualifier qual that has the key "name", the operator method QualifierOperatorEqual, and the value "Smith". Once constructed, the qualifier qual is used to filter an in-memory array.

NSArray employees /* Assume this exists */
EOKeyValueQualifier qual = new EOKeyValueQualifier("name", 
    EOQualifier.QualifierOperatorEqual, "Smith");
return EOQualifier.filteredArrayWithQualifier(employees, qual);




Instance Methods



evaluateWithObject

public boolean evaluateWithObject(Object anObject)

Returns true if the object anObject satisfies the qualifier, false otherwise. When an EOKeyValueQualifier object receives the evaluateWithObjectmessage, it evaluates anObject to determine if it meets the qualifier criteria. This method can throw one of several possible exceptions if an error occurs. If your application allows users to construct arbitrary qualifiers (such as through a user interface), you may want to write code to catch any exceptions and properly respond to errors (for example, by displaying a panel saying that the user typed a poorly formed qualifier).

key

public String key()

Returns the receiver's key.

selector

public NSSelector selector()

Returns the receiver's selector.

value

public Object value()

Returns the receiver's value.


Table of Contents