Inherits From:
Object (Java Client)
NSObject (Yellow Box)
Package:
com.apple.client.eocontrol (Java Client)
com.apple.yellow.eocontrol (Yellow Box)
EOQualifier is an abstract class for objects that hold information used to restrict selections on objects or database rows according to specified criteria. With the exception of EOSQLQualifier (EOAccess), qualifiers aren't based on SQL and they don't rely upon an EOModel (EOAccess). Thus, the same qualifier can be used both to perform in-memory searches and to fetch from the database.
You never instantiate an instance of EOQualifier. Rather, you use one of its subclasses-one of the following or your own custom EOQualifier subclass:
Subclass | Purpose |
EOKeyValueQualifier | Compares the named property of an object to a supplied value, for example, "weight > 150". |
EOKeyComparisonQualifier | Compares the named property of one object with the named property of another, for example "name = wife.name". |
EOAndQualifier | Contains multiple qualifiers, which it conjoins. For example, "name = 'Fred' AND age < 20". |
EOOrQualifier | Contains multiple qualifiers, which it disjoins. For example, "name = 'Fred' OR name = 'Ethel'". |
EONotQualifier | Contains a single qualifier, which it negates. For example, "NOT (name = 'Fred')". |
EOSQLQualifier | Contains unstructured text that can be transformed into a SQL expression. EOSQLQualifier provides a way to create SQL expressions with any arbitrary SQL. Because EOSQLQualifiers can't be evaluated against objects in memory and because they contain database and SQL-specific content, you should use EOQualifier wherever possible. |
The interface EOQualifierEvaluation defines how qualifiers are evaluated in memory. To evaluate qualifiers in a database, methods in EOSQLExpression (EOAccess) and EOEntity (EOAccess) are used to generate SQL for qualifiers. Note that all of the SQL generation functionality is contained in the access layer.
For more information on using EOQualifiers, see the sections
The following NSSelector constants are defined to represent the different qualifier operators:
QualifierOperatorEqual | QualifierOperatorLessThanOrEqualTo |
QualifierOperatorNotEqual | QualifierOperatorGreaterThanOrEqualTo |
QualifierOperatorLessThan | QualifierOperatorContains |
QualifierOperatorGreaterThan | QualifierOperatorLike |
QualifierOperatorCaseInsensitiveLike |
EOQualifier
public com.apple.yellow.eocontrol.EOQualifier (java.lang.String qualifierFormat, next.util.ImmutableVector arguments)
Creates and returns a new EOQualifier object. Parses the format string qualifierFormat and the specified arguments, initializes the new EOQualifier with them, and returns that EOQualifier. Conversion specifications (occurrences of %@) in qualifierFormat are replaced using the value objects in arguments. For more information on how qualifierFormat and arguments are used, see the method description for the static method qualifierWithQualifierFormat .
You would never use this constructor to create an EOQualifier. Instead, you'd use the static method qualifierWithQualifierFormat to create an instance of one of the qualifier subclasses.
A subclass of EOQualifier should write a constructor with the same formatString and arguments arguments that invokes the EOQualifier implementation.
allQualifierOperators
public static NSArray allQualifierOperators ()
Returns an NSArray containing all of the operators supported by EOQualifier: =, !=, <, <=, >, >=, "like", and "caseInsensitiveLike".
See also: + relationalQualifierOperators
filterArrayWithQualifier
public static void filterArrayWithQualifier (NSMutableArray objects, EOQualifier aQualifier)
Filters objects in place so that it contains only objects matching aQualifier.
See also: filteredArrayWithQualifier
filteredArrayWithQualifier
public static NSArray filteredArrayWithQualifier (NSArray objects, EOQualifier aQualifier)
Returns a new array that contains only the objects from objects matching aQualifier.
See also: filterArrayWithQualifier
operatorSelectorForString
public static NSSelector operatorSelectorForString (java.lang.String aString)
Returns an operator selector based on the string aString. This method is used in parsing a qualifier. For example, the following statement returns the selector QualifierOperatorNotEqual .
Selector selector = Qualifier.operatorSelectorForString("!=");
The possible values of aString are =, ==, !=, <, >, <=, >=, "like", and "caseInsensitiveLike".
You'd probably only use this method if you were writing your own qualifier parser.
See also: + stringForOperatorSelector
qualifierToMatchAllValues
public static EOQualifier qualifierToMatchAllValues (NSDictionary aNSDictionary)
This method is only available in Yellow Box; there is no equivalent in Java Client. Takes a dictionary of search criteria, from which the method creates EOKeyValueQualifiers (one for each dictionary entry). The method ANDs these qualifiers together, and returns the resulting EOAndQualifier.
See also:
qualifierToMatchAnyValue
public static EOQualifier qualifierToMatchAnyValue (NSDictionary aNSDictionary)
This method is only available in Yellow Box; there is no equivalent in Java Client. Takes a dictionary of search criteria, from which the method creates EOKeyValueQualifiers (one for each dictionary entry). The method ORs these qualifiers together, and returns the resulting EOOrQualifier.
See also:
qualifierWithQualifierFormat
public static EOQualifier qualifierWithQualifierFormat (java.lang.String qualifierFormat, NSArray arguments)
This method is only available in Yellow Box; there is no equivalent in Java Client. Parses the format string qualifierFormat and the specified arguments, uses them to create an EOQualifier, and returns the EOQualifier. Conversion specifications (occurrences of %@) in qualifierFormat are replaced using the value objects in arguments.
Based on the content of qualifierFormat, this method generates a tree of the basic qualifier types. For example, the format string "firstName = 'Joe' AND department = 'Facilities'" generates an EOAndQualifier that contains two "sub" EOKeyValueQualifiers. The following code excerpt shows a typical way to use the qualifierWithQualifierFormat method. The excerpt constructs an EOFetchSpecification, which includes an entity name and a qualifier. It then applies the EOFetchSpecification to the EODisplayGroup's data source and tells the EODisplayGroup to fetch.
EODisplayGroup displayGroup; /* Assume this exists.*/
EOQualifier qualifier;
EOFetchSpecification fetchSpec;
EODatabaseDataSource dataSource;
dataSource = (EODatabaseDataSource)displayGroup.dataSource();
qualifier = EOQualifier.qualifierWithQualifierFormat("cardType = 'Visa'");
fetchSpec = new EOFetchSpecification("Member", qualifier, null), null);
dataSource.setFetchSpecification(fetchSpec);
displayGroup.fetch();
qualifierWithQualifierFormat performs no verification to ensure that keys referred to by the format string qualifierFormat exist. It throws an exception if qualifierFormat contains any syntax errors.
relationalQualifierOperators
public static NSArray relationalQualifierOperators ()
Returns an NSArray containing all of the relational operators supported by EOQualifier: =, !=, <, <=, >, and >=. In other words, returns all of the EOQualifier operators except for the ones that work exclusively on strings: "like" and "caseInsensitiveLike".
See also: + allQualifierOperators
stringForOperatorSelector
public static java.lang.String stringForOperatorSelector (NSSelector aSelector)
Returns a string representation of the selector aSelector. For example, the following statement returns the string "!=":
java.lang.String operator =
EOQualifier.stringForOperatorSelector(EOQualifier.QualifierOperatorNotEqual);
The possible values for selector are as follows:
You'd probably only use this method if you were writing your own parser.
See also: + operatorSelectorForString
bindingKeys
NSArray bindingKeys ()
This method is only available in Yellow Box; there is no equivalent in Java Client. Returns an array of strings which are the names of the known variables. Multiple occurrences of the same variable will only appear once in this list.
keyPathForBindingKey
public java.lang.String keyPathForBindingKey (java.lang.String key)
This method is only available in Yellow Box; there is no equivalent in Java Client. Returns a string which is the "left-hand-side" of the variable in the qualifier. e.g. If you have a qualifier "salary > $amount and manager.lastName = $manager", then calling bindingKeys would return the array ("amount", "manager"). Calling keyPathForBindingKey would return salary for amount, and manager.lastname for manager.
qualifierWithBindings
public abstract EOQualifier qualifierWithBindings (NSDictionary bindings, boolean requiresAll)
This method is only available in Yellow Box; there is no equivalent in Java Client. Returns a new qualifier substituting all variables with values found in bindings. If requiresAll is YES, any variable not found in bindings will throw a QualifierVariableSubstitutionException. If requiresAll is NO, missing variable values will cause the qualifier node to be pruned from the tree.
validateKeysWithRootClassDescription
public abstract java.lang.Throwable validateKeysWithRootClassDescription (EOClassDescription classDesc)
This method is only available in Yellow Box; there is no equivalent in Java Client. Validates that the receiver contains keys and key paths that belong to or originate from classDesc. This method returns an exception if an unknown key is found, otherwise it returns null
to indicate that the keys contained by the qualifier are valid.