| 
 | WebObjects 5.4.2 | ||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||
java.lang.Objectcom.webobjects.eocontrol.EOQualifier
com.webobjects.eocontrol.EOKeyComparisonQualifier
public class EOKeyComparisonQualifier
EOKeyComparisonQualifier is a subclass of EOQualifier that compares a named property of an object with a named value of another object. For example, to return all of the employees whose salaries are greater than those of their managers, you might use an expression such as "salary > manager.salary", where "salary" is the left key and "manager.salary" is the right key. The "left key" is the property of the first object that's being compared to a property in a second object. The property in the second object is the "right key". Both the left key and the right key might be key paths. You can use EOKeyComparisonQualifier to compare properties of two different objects or to compare two properties of the same object.
 EOKeyComparisonQualifier implements the EOQualifierEvaluation interface, which defines the method evaluateWithObject for in-memory evaluation. When an EOKeyComparisonQualifier 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, EOKeyComparisonQualifier 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).
| Nested Class Summary | 
|---|
| Nested classes/interfaces inherited from class com.webobjects.eocontrol.EOQualifier | 
|---|
| EOQualifier.Comparison, EOQualifier.ComparisonSupport, EOQualifier.QualifierVariableSubstitutionException | 
| Nested classes/interfaces inherited from interface com.webobjects.foundation.NSCoding | 
|---|
| NSCoding.Support | 
| Nested classes/interfaces inherited from interface com.webobjects.eocontrol.EOKeyValueArchiving | 
|---|
| EOKeyValueArchiving.Awaking, EOKeyValueArchiving.FinishInitialization, EOKeyValueArchiving.Support | 
| Field Summary | 
|---|
| Fields inherited from class com.webobjects.eocontrol.EOQualifier | 
|---|
| QualifierOperatorCaseInsensitiveLike, QualifierOperatorContains, QualifierOperatorEqual, QualifierOperatorGreaterThan, QualifierOperatorGreaterThanOrEqualTo, QualifierOperatorLessThan, QualifierOperatorLessThanOrEqualTo, QualifierOperatorLike, QualifierOperatorNotEqual | 
| Constructor Summary | |
|---|---|
| EOKeyComparisonQualifier(String leftKey,
                         NSSelector selector,
                         String rightKey)Creates and returns a new EOKeyComparisonQualifier object that compares the properties named by leftKeyandrightKey, using the operator methodselector, one of the list below. | |
| Method Summary | |
|---|---|
|  void | addQualifierKeysToSet(NSMutableSet qualKeys)Takes the receiver's leftKeyandrightKeyand inserts intoqualKeys;nullvalues are skipped. | 
|  Class | classForCoder()Allows the receiver to substitute a class other than its own (for example, a public superclass) for use during archiving (encoding) by an NSCoder. | 
| static Object | decodeObject(NSCoder coder)(Re)creates an object based on type information and data stored in coder. | 
| static Object | decodeWithKeyValueUnarchiver(EOKeyValueUnarchiver unarchiver)Unarchives and returns the newly-unarchived object; provides conformance to the EOKeyValueArchiving interface. | 
|  void | encodeWithCoder(NSCoder coder)Archives the receiver's type information and data into coder. | 
|  void | encodeWithKeyValueArchiver(EOKeyValueArchiver archiver)Archives the receiver; provides conformance to the EOKeyValueArchiving interface. | 
|  boolean | equals(Object other)The comparison made between the receiver and otheris done by each one of the EOKeyComparisonQualifier components. | 
|  boolean | evaluateWithObject(Object object)Returns trueif the objectobjectsatisfies the qualifier,falseotherwise. | 
|  String | leftKey()The property of the object that's being compared to a property in a second object. | 
|  EOQualifier | qualifierWithBindings(NSDictionary bindings,
                      boolean requiresAll)Overriding EOQualifier's behavior. | 
|  String | rightKey()The property in the second object to be compared. | 
|  NSSelector | selector()The operator method used to do the comparison. | 
|  String | toString() | 
|  void | validateKeysWithRootClassDescription(EOClassDescription classDesc)Ensures that the receiver contains keys and key paths that belong to or originate from classDesc. | 
| Methods inherited from class com.webobjects.eocontrol.EOQualifier | 
|---|
| allQualifierKeys, allQualifierOperators, bindingKeys, clone, filterArrayWithQualifier, filteredArrayWithQualifier, keyPathForBindingKey, operatorSelectorForSelectorNamed, operatorSelectorForString, qualifierToMatchAllValues, qualifierToMatchAnyValue, qualifierWithQualifierFormat, relationalQualifierOperators, stringForOperatorSelector | 
| Methods inherited from class java.lang.Object | 
|---|
| finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait | 
| Constructor Detail | 
|---|
public EOKeyComparisonQualifier(String leftKey,
                                NSSelector selector,
                                String rightKey)
leftKey and rightKey, using the operator method selector, one of the list below.
 
 Enterprise Objects Framework supports SQL generation for these methods only. You can generate SQL using the EOSQLExpression static method sqlStringForKeyComparisonQualifier.
 
 For example, the following excerpt creates an EOKeyComparisonQualifier qual that has the left key lastName, the operator method EOQualifierOperatorEqual, and the right key member.lastName. Once constructed, the qualifier
 qual is used to filter an in-memory array. The code excerpt returns an array of Guest objects whose lastName properties have the same value as the lastName property of the guest's sponsoring member (this example is based on the
 Rentals sample database).
 
  <blockquote>
 
 NSArray guests;
 EOKeyComparisonQualifier qual = new EOKeyComparisonQualifier(lastName, EOQualifier.QualifierOperatorEqual, member.lastName);
 return (EOQualifier.filteredArrayWithQualifier(guests, qual));
 
 </blockquote>
 
 
leftKey - key path to first propertyselector - the operator method used to comparerightKey - key path to second property; compared against the leftKeyEOQualifier, 
NSSelector| Method Detail | 
|---|
public boolean equals(Object other)
other is done by each one of the EOKeyComparisonQualifier components. The leftKey, rightKey and selctor of the receiver will be compared to the other object to find out if
 they are equal or not.
equals in class Objectother - the object against which the receiver is compared
true if the input object is equal to the receiver; else falsepublic boolean evaluateWithObject(Object object)
true if the object object satisfies the qualifier, false otherwise. When an EOKeyComparisonQualifier object receives an evaluateWithObject message, it evaluates object to determine if it meets the qualifier
 criteria. This method can throw one of several possible exceptions if an error occurs. If the 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).
evaluateWithObject in interface EOQualifierEvaluationevaluateWithObject in class EOQualifierobject - the object which is evaluated with respect to the receiver's criteria
true if the object object satisfies the qualifier, false otherwise
IllegalArgumentException - (for example, if object is null)public String leftKey()
EOKeyComparisonQualifierpublic NSSelector selector()
EOKeyComparisonQualifierpublic String rightKey()
EOKeyComparisonQualifierpublic String toString()
toString in class Objectpublic void validateKeysWithRootClassDescription(EOClassDescription classDesc)
classDesc. This method raises an exception if an unknown key is found, otherwise the keys contained by the qualifier are valid.
validateKeysWithRootClassDescription in class EOQualifierclassDesc - bridge between enterprise objects and the metadata contained in an external source of information
IllegalStateException - if one of the keys in the receiver is null or invalid
public EOQualifier qualifierWithBindings(NSDictionary bindings,
                                         boolean requiresAll)
qualifierWithBindings in EOKeyComparisonQualifier simply returns the receiver.
qualifierWithBindings in class EOQualifierbindings - the immutable dictionary of bindingsrequiresAll - true if all the values need to match; else false
public void addQualifierKeysToSet(NSMutableSet qualKeys)
leftKey and rightKey and inserts into qualKeys; null values are skipped.
addQualifierKeysToSet in class EOQualifierqualKeys - the input mutable set into which the receiver's keys are insertedpublic Class classForCoder()
getClass method.
classForCoder in interface NSCodingEOKeyComparisonQualifier.encodeWithCoder(NSCoder coder), 
EOKeyComparisonQualifier.decodeObject(NSCoder coder), 
NSCoder, 
NSCodingpublic static Object decodeObject(NSCoder coder)
coder.
coder - stores object type information along with an object's data
coder.EOKeyComparisonQualifier.encodeWithCoder(NSCoder coder), 
NSCoder, 
NSCodingpublic void encodeWithCoder(NSCoder coder)
coder. The receiver can then be recreated using decodeObject. Custom type information can be used by overriding classForCoder.
encodeWithCoder in interface NSCodingcoder - stores object type information along with an object's dataEOKeyComparisonQualifier.decodeObject(NSCoder coder), 
EOKeyComparisonQualifier.classForCoder(), 
NSCoder, 
NSCodingpublic void encodeWithKeyValueArchiver(EOKeyValueArchiver archiver)
encodeWithKeyValueArchiver in interface EOKeyValueArchivingarchiver - the key-value archiver with which the receiver should be encodedEOKeyValueArchiving, 
EOKeyValueArchiverpublic static Object decodeWithKeyValueUnarchiver(EOKeyValueUnarchiver unarchiver)
unarchiver - the key-value unarchiver with which the receiver should be decodedEOKeyValueArchiving, 
EOKeyValueArchiver| 
 | Last updated June 2008 | ||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||