public class ERXQ extends Object
EOQualifier qualifier = new ERXAndQualifier( new NSArray(new Object[] { new ERXKeyValueQualifier("name", EOQualifier.QualifierOperatorsEquals, "Mike"), new ERXKeyValueQualifier("admin", EOQualifier.QualifierOperatorsEquals, Boolean.TRUE) }));
... becomes ...
EOQualifier qualifier = ERXQ.and(ERXQ.equals("name", "Mike"), ERXQ.isTrue("admin"));
Modifier and Type | Field and Description |
---|---|
static NSSelector |
CONTAINS
Equivalent to EOQualifier.QualifierOperatorContains
|
static NSSelector |
EQ
Equivalent to EOQualifier.QualifierOperatorEqual
|
static NSSelector |
GT
Equivalent to EOQualifier.QualifierOperatorGreaterThan
|
static NSSelector |
GTEQ
Equivalent to EOQualifier.QualifierOperatorGreaterThanOrEqualTo
|
static NSSelector |
ILIKE
Equivalent to EOQualifier.QualifierOperatorCaseInsensitiveLike
|
static NSSelector |
LIKE
Equivalent to EOQualifier.QualifierOperatorLike
|
static NSSelector |
LT
Equivalent to EOQualifier.QualifierOperatorLessThan
|
static NSSelector |
LTEQ
Equivalent to EOQualifier.QualifierOperatorLessThanOrEqualTo
|
static NSSelector |
NE
Equivalent to EOQualifier.QualifierOperatorNotEqual
|
Constructor and Description |
---|
ERXQ() |
Modifier and Type | Method and Description |
---|---|
static ERXAndQualifier |
and(EOQualifier... qualifiersArray)
Equivalent to new ERXAndQualifier(new NSArray(qualifiersArray).
|
static ERXAndQualifier |
and(NSArray<? extends EOQualifier> qualifiers)
Equivalent to new ERXAndQualifier(new NSArray(qualifiersArray).
|
static EOQualifier |
between(String key,
Object lowerBound,
Object upperBound)
Equivalent to key > lowerBound and key < upperBound (exclusive).
|
static EOQualifier |
between(String key,
Object lowerBound,
Object upperBound,
boolean inclusive)
Equivalent to key >= lowerBound and key <= upperBound (inclusive).
|
static ERXKeyValueQualifier |
compare(String key,
NSSelector operator,
Object value)
Equivalent to new ERXKeyValueQualifier(key, operator, value);
|
static ERXKeyValueQualifier |
contains(String key,
String value)
Equivalent to new ERXKeyValueQualifier(key,
EOQualifier.OperatorCaseInsensitiveLike, "*" + value + "*").
|
static ERXOrQualifier |
containsAll(NSArray<String> keys,
String tokensWithWhitespace)
Returns a qualifier that evalutes to true when the value of any of the
given keys contains all of the given tokens (insensitively) in the search
string.
|
static ERXAndQualifier |
containsAll(String key,
String tokensWithWhitespace)
Returns a qualifier that evalutes to true when the value of the given key
contains all of the given tokens (insensitively) in the search string.
|
static ERXAndQualifier |
containsAll(String key,
String[] tokens)
Returns a qualifier that evalutes to true when the value of the given key
contains all of the given tokens (insensitively).
|
static ERXAndQualifier |
containsAllInAny(String[] keys,
String tokensWithWhitespace)
Returns a qualifier that evaluates to true when all values in the given
tokens are found when searching across any of the keypaths.
|
static ERXAndQualifier |
containsAllInAny(String[] keys,
String[] tokens)
Returns a qualifier that evaluates to true when all values in the given
tokens are found when searching across any of the keypaths.
|
static ERXOrQualifier |
containsAny(NSArray<String> keys,
String tokensWithWhitespace)
Returns a qualifier that evalutes to true when the value of any of the
given keys contains any of the given tokens (insensitively) in the search
string.
|
static ERXOrQualifier |
containsAny(String key,
String tokensWithWhitespace)
Returns a qualifier that evalutes to true when the value of the given key
contains any of the given tokens (insensitively) in the search string.
|
static ERXOrQualifier |
containsAny(String key,
String[] tokens)
Returns a qualifier that evalutes to true when the value of the given key
contains any of the given tokens (insensitively).
|
static ERXKeyValueQualifier |
containsObject(String key,
Object value)
Equivalent to new ERXKeyValueQualifier(key, EOQualifier.OperatorContains,
value).
|
static ERXKeyValueQualifier |
endsWith(String key,
String value)
Equivalent to new ERXKeyValueQualifier(key,
EOQualifier.OperatorLike, "*" + value).
|
static ERXKeyValueQualifier |
endsWithInsensitive(String key,
String value)
Equivalent to new ERXKeyValueQualifier(key,
EOQualifier.OperatorCaseInsensitiveLike, "*" + value).
|
static <T> ERXKeyComparisonQualifier |
equals(ERXKey<T> key,
ERXKey<T> value)
Equivalent to new ERXKeyComparisonQualifier(key,
EOQualifier.QualifierOperatorEqual, value);
|
static ERXKeyValueQualifier |
equals(String key,
Object value)
Equivalent to new ERXKeyValueQualifier(key,
EOQualifier.QualifierOperatorEqual, value);
|
static NSArray<EOKeyValueQualifier> |
extractKeyValueQualifiers(EOQualifier qualifier)
Analyzes the given qualifier and returns all found
EOKeyValueQualifier objects
contained within. |
static void |
filter(NSMutableArray<?> array,
EOQualifier qualifier)
Equivalent to EOQualifier.filterArrayWithQualifier(NSMutableArray,
EOQualifier)
|
static <T> NSArray<T> |
filtered(NSArray<T> array,
EOQualifier qualifier)
Equivalent to EOQualifier.filteredArrayWithQualifier(NSArray,
EOQualifier)
|
static <T> T |
first(NSArray<T> array,
EOQualifier qualifier)
Returns the first object that matches the qualifier in the given array
(or null if there is no match).
|
static <T> ERXKeyComparisonQualifier |
greaterThan(ERXKey<T> key,
ERXKey<T> value)
Equivalent to new ERXKeyComparisonQualifier(key,
EOQualifier.QualifierOperatorGreaterThan, value);
|
static ERXKeyValueQualifier |
greaterThan(String key,
Object value)
Equivalent to new ERXKeyValueQualifier(key,
EOQualifier.QualifierOperatorGreaterThan, value);
|
static <T> ERXKeyComparisonQualifier |
greaterThanOrEqualTo(ERXKey<T> key,
ERXKey<T> value)
Equivalent to new ERXKeyComparisonQualifier(key,
EOQualifier.QualifierOperatorGreaterThanOrEqualTo, value);
|
static ERXKeyValueQualifier |
greaterThanOrEqualTo(String key,
Object value)
Equivalent to new ERXKeyValueQualifier(key,
EOQualifier.QualifierOperatorGreaterThanOrEqualTo, value);
|
static ERXKeyValueQualifier |
has(String key,
NSArray values)
Equivalent to new ERXToManyQualifier(key, values);
|
static ERXKeyValueQualifier |
hasAtLeast(String key,
NSArray values,
int min)
Equivalent to new ERXToManyQualifier(key, values);
|
static ERXKeyValueQualifier |
hasValues(String key,
NSArray values)
Equivalent to new ERXInQualifier(key, values);
|
static ERXOrQualifier |
in(String key,
NSArray<?> values)
Equivalent to a new ERXOrQualifier of EOKeyValueQualifier with key equals
value for each value.
|
static ERXOrQualifier |
inObjects(String key,
Object... values)
Equivalent to a new ERXOrQualifier of EOKeyValueQualifier with key equals
value for each value.
|
static EOQualifier |
is(ERXGenericRecord value)
Return an identity qualifier to use with ERXExistsQualifier for example
|
static ERXKeyValueQualifier |
is(String key,
Object value)
Equivalent to new ERXKeyValueQualifier(key,
EOQualifier.QualifierOperatorEqual, value);
|
static ERXKeyValueQualifier |
isFalse(String key)
Equivalent to new ERXKeyValueQualifier(key,
EOQualifier.QualifierOperatorEqual, Boolean.FALSE);
|
static EOQualifier |
isIn(NSArray<? extends ERXGenericRecord> valueArray)
Return a OR qualifier of identity qualifiers using each value from the param array
|
static ERXKeyValueQualifier |
isNotNull(String key)
Equivalent to new ERXKeyValueQualifier(key,
EOQualifier.QualifierOperatorNotEqual, null);
|
static ERXKeyValueQualifier |
isNull(String key)
Equivalent to new ERXKeyValueQualifier(key,
EOQualifier.QualifierOperatorEqual, null);
|
static ERXKeyValueQualifier |
isNull(String key,
boolean yesOrNo)
Returns isNull or isNotNull depending on the value of yesOrNo.
|
static ERXKeyValueQualifier |
isTrue(String key)
Equivalent to new ERXKeyValueQualifier(key,
EOQualifier.QualifierOperatorEqual, Boolean.TRUE);
|
static String |
keyPath(String... elements)
Generates a key path from a var args list of strings.
|
static <T> ERXKeyComparisonQualifier |
lessThan(ERXKey<T> key,
ERXKey<T> value)
Equivalent to new ERXKeyComparisonQualifier(key,
EOQualifier.QualifierOperatorLessThan, value);
|
static ERXKeyValueQualifier |
lessThan(String key,
Object value)
Equivalent to new ERXKeyValueQualifier(key,
EOQualifier.QualifierOperatorLessThan, value);
|
static <T> ERXKeyComparisonQualifier |
lessThanOrEqualTo(ERXKey<T> key,
ERXKey<T> value)
Equivalent to new ERXKeyComparisonQualifier(key,
EOQualifier.QualifierOperatorLessThanOrEqualTo, value);
|
static ERXKeyValueQualifier |
lessThanOrEqualTo(String key,
Object value)
Equivalent to new ERXKeyValueQualifier(key,
EOQualifier.QualifierOperatorLessThanOrEqualTo, value);
|
static ERXKeyValueQualifier |
like(String key,
Object value)
Equivalent to new ERXKeyValueQualifier(key,
EOQualifier.QualifierOperatorLike, value);
|
static ERXKeyValueQualifier |
likeInsensitive(String key,
Object value)
Equivalent to new ERXKeyValueQualifier(key,
EOQualifier.QualifierOperatorCaseInsensitiveLike, value);
|
static ERXKeyValueQualifier |
matches(String key,
String value)
Equivalent to new ERXRegExQualifier(key, value);
|
static EOQualifier |
matchingValues(Object... values)
Inspired by EOUtilities.objectsWithValues method, creates EOKeyValueQualifiers for a variable-length list of parameters,
combines these qualifier into an EOAndQualifier and returns that qualifier.
|
static ERXNotQualifier |
not(EOQualifier qualifier)
Equivalent to new ERXNotQualifier(qualifier);
|
static <T> ERXKeyComparisonQualifier |
notEquals(ERXKey<T> key,
ERXKey<T> value)
Equivalent to new ERXKeyComparisonQualifier(key,
EOQualifier.QualifierOperatorNotEqual, value);
|
static ERXKeyValueQualifier |
notEquals(String key,
Object value)
Equivalent to new ERXKeyValueQualifier(key,
EOQualifier.QualifierOperatorNotEqual, value);
|
static ERXAndQualifier |
notIn(String key,
NSArray values)
Equivalent to a new ERXAndQualifier of
EONotQualifier(EOKeyValueQualifier) with key equals value for each value.
|
static ERXAndQualifier |
notInObjects(String key,
Object... values)
Equivalent to a new ERXAndQualifier of
EONotQualifier(EOKeyValueQualifier) with key equals value for each value.
|
static <T> T |
one(NSArray<T> array,
EOQualifier qualifier)
Returns the one object that matches the qualifier in the given array (or
null if there is no match).
|
static ERXOrQualifier |
or(EOQualifier... qualifiersArray)
Equivalent to new ERXOrQualifier(new NSArray(qualifiersArray).
|
static ERXOrQualifier |
or(NSArray<? extends EOQualifier> qualifiers)
Equivalent to new ERXOrQualifier(new NSArray(qualifiersArray).
|
static EOQualifier |
replaceQualifierWithQualifier(EOQualifier qualifier,
EOQualifier searchFor,
EOQualifier replaceWith)
Takes a qualifier and searches for the given qualifier within to replace it with another one.
|
static <T> T |
requiredOne(NSArray<T> array,
EOQualifier qualifier)
Returns the one object that matches the qualifier in the given array (or
throws if there is no match).
|
static ERXKeyValueQualifier |
startsWith(String key,
String value)
Equivalent to new ERXKeyValueQualifier(key,
EOQualifier.OperatorLike, value + "*").
|
static ERXKeyValueQualifier |
startsWithInsensitive(String key,
String value)
Equivalent to new ERXKeyValueQualifier(key,
EOQualifier.OperatorCaseInsensitiveLike, value + "*").
|
public static final NSSelector EQ
public static final NSSelector NE
public static final NSSelector LT
public static final NSSelector GT
public static final NSSelector LTEQ
public static final NSSelector GTEQ
public static final NSSelector CONTAINS
public static final NSSelector LIKE
public static final NSSelector ILIKE
public static <T> NSArray<T> filtered(NSArray<T> array, EOQualifier qualifier)
T
- the type of the arrayarray
- the array to filterqualifier
- the qualifier to filter withpublic static void filter(NSMutableArray<?> array, EOQualifier qualifier)
array
- the array to filter (in place)qualifier
- the qualifier to filter withpublic static <T> T one(NSArray<T> array, EOQualifier qualifier)
T
- the type of the objectsarray
- the array to filterqualifier
- the qualifier to filter onIllegalStateException
- if more than one object matchedpublic static <T> T first(NSArray<T> array, EOQualifier qualifier)
T
- the type of the objectsarray
- the array to filterqualifier
- the qualifier to filter onpublic static <T> T requiredOne(NSArray<T> array, EOQualifier qualifier)
T
- the type of the objectsarray
- the array to filterqualifier
- the qualifier to filter onIllegalStateException
- if more than one object matchedNoSuchElementException
- if no objects matchedpublic static ERXOrQualifier or(EOQualifier... qualifiersArray)
qualifiersArray
- the array of qualifiers to orpublic static ERXOrQualifier or(NSArray<? extends EOQualifier> qualifiers)
qualifiers
- the NSArray of qualifiers to orpublic static ERXAndQualifier and(EOQualifier... qualifiersArray)
qualifiersArray
- the array of qualifiers to andpublic static ERXAndQualifier and(NSArray<? extends EOQualifier> qualifiers)
qualifiers
- the NSArray of qualifiers to andpublic static ERXKeyValueQualifier like(String key, Object value)
key
- the keyvalue
- the valuepublic static ERXKeyValueQualifier likeInsensitive(String key, Object value)
key
- the keyvalue
- the valuepublic static ERXKeyValueQualifier matches(String key, String value)
key
- the keyvalue
- the valuepublic static ERXKeyValueQualifier hasValues(String key, NSArray values)
key
- the keyvalues
- the valuespublic static ERXKeyValueQualifier has(String key, NSArray values)
key
- the keyvalues
- the valuespublic static ERXKeyValueQualifier hasAtLeast(String key, NSArray values, int min)
key
- the keyvalues
- the valuesmin
- the minimum number of objects from values to matchpublic static ERXKeyValueQualifier equals(String key, Object value)
key
- the keyvalue
- the valuepublic static <T> ERXKeyComparisonQualifier equals(ERXKey<T> key, ERXKey<T> value)
key
- the keyvalue
- the valuepublic static EOQualifier isIn(NSArray<? extends ERXGenericRecord> valueArray)
valueArray
- the array of valuespublic static EOQualifier is(ERXGenericRecord value)
value
- the valuepublic static ERXKeyValueQualifier is(String key, Object value)
key
- the keyvalue
- the valuepublic static ERXKeyValueQualifier isNull(String key, boolean yesOrNo)
key
- the keyyesOrNo
- if true, returns isNull, if false, returns isNotNullpublic static ERXKeyValueQualifier isNull(String key)
key
- the keypublic static ERXKeyValueQualifier isNotNull(String key)
key
- the keypublic static ERXKeyValueQualifier isTrue(String key)
key
- the keypublic static ERXKeyValueQualifier isFalse(String key)
key
- the keypublic static ERXKeyValueQualifier notEquals(String key, Object value)
key
- the keyvalue
- the valuepublic static <T> ERXKeyComparisonQualifier notEquals(ERXKey<T> key, ERXKey<T> value)
key
- the keyvalue
- the valuepublic static ERXKeyValueQualifier lessThan(String key, Object value)
key
- the keyvalue
- the valuepublic static <T> ERXKeyComparisonQualifier lessThan(ERXKey<T> key, ERXKey<T> value)
key
- the keyvalue
- the valuepublic static ERXKeyValueQualifier greaterThan(String key, Object value)
key
- the keyvalue
- the valuepublic static <T> ERXKeyComparisonQualifier greaterThan(ERXKey<T> key, ERXKey<T> value)
key
- the keyvalue
- the valuepublic static ERXKeyValueQualifier lessThanOrEqualTo(String key, Object value)
key
- the keyvalue
- the valuepublic static <T> ERXKeyComparisonQualifier lessThanOrEqualTo(ERXKey<T> key, ERXKey<T> value)
key
- the keyvalue
- the valuepublic static ERXKeyValueQualifier greaterThanOrEqualTo(String key, Object value)
key
- the keyvalue
- the valuepublic static <T> ERXKeyComparisonQualifier greaterThanOrEqualTo(ERXKey<T> key, ERXKey<T> value)
key
- the keyvalue
- the valuepublic static ERXNotQualifier not(EOQualifier qualifier)
qualifier
- the qualifier to notpublic static ERXKeyValueQualifier compare(String key, NSSelector operator, Object value)
key
- the keyoperator
- ERXQ.EQ, NE, GT, LT, etcvalue
- the valuepublic static ERXOrQualifier inObjects(String key, Object... values)
key
- the keyvalues
- the valuespublic static ERXAndQualifier notInObjects(String key, Object... values)
key
- the keyvalues
- the valuespublic static ERXOrQualifier in(String key, NSArray<?> values)
key
- the keyvalues
- the valuespublic static ERXAndQualifier notIn(String key, NSArray values)
key
- the keyvalues
- the valuespublic static EOQualifier between(String key, Object lowerBound, Object upperBound)
key
- the keylowerBound
- the lower bound valueupperBound
- the upper bound valuepublic static EOQualifier between(String key, Object lowerBound, Object upperBound, boolean inclusive)
key
- the keylowerBound
- the lower bound valueupperBound
- the upper bound valueinclusive
- if the lowerBound and upperBound should be inclusivepublic static ERXKeyValueQualifier startsWith(String key, String value)
key
- the keyvalue
- the substring valuepublic static ERXKeyValueQualifier startsWithInsensitive(String key, String value)
key
- the keyvalue
- the substring valuepublic static ERXKeyValueQualifier endsWith(String key, String value)
key
- the keyvalue
- the substring valuepublic static ERXKeyValueQualifier endsWithInsensitive(String key, String value)
key
- the keyvalue
- the substring valuepublic static ERXKeyValueQualifier containsObject(String key, Object value)
key
- the keyvalue
- the valuepublic static ERXKeyValueQualifier contains(String key, String value)
key
- the keyvalue
- the substring valuepublic static ERXOrQualifier containsAny(NSArray<String> keys, String tokensWithWhitespace)
keys
- the keystokensWithWhitespace
- a whitespace separated list of tokens to search forpublic static ERXOrQualifier containsAny(String key, String tokensWithWhitespace)
key
- the keytokensWithWhitespace
- a whitespace separated list of tokens to search forpublic static ERXOrQualifier containsAny(String key, String[] tokens)
key
- the keytokens
- the list of tokens to search forpublic static ERXOrQualifier containsAll(NSArray<String> keys, String tokensWithWhitespace)
keys
- the keystokensWithWhitespace
- a whitespace separated list of tokens to search forpublic static ERXAndQualifier containsAll(String key, String tokensWithWhitespace)
key
- the keytokensWithWhitespace
- a whitespace separated list of tokens to search forpublic static ERXAndQualifier containsAll(String key, String[] tokens)
key
- the keytokens
- the list of tokens to search forpublic static ERXAndQualifier containsAllInAny(String[] keys, String tokensWithWhitespace)
keys
- keypaths to perform search intokensWithWhitespace
- tokens to search forpublic static ERXAndQualifier containsAllInAny(String[] keys, String[] tokens)
keys
- keypaths to perform search intokens
- tokens to search forpublic static String keyPath(String... elements)
qualifiers.addObject(ERXQ.equals(Distribution.PUBLICATION + "." + Publication.AD + "." + Ad.STATE, DisplayAdStateMachine.ReadyForPrinting));to:
qualifiers.addObject(ERXQ.equals(ERXQ.keyPath(Distribution.PUBLICATION, Publication.AD, Ad.STATE, DisplayAdStateMachine.ReadyForPrinting));
elements
- one or more string to concatenate into a keyPathpublic static NSArray<EOKeyValueQualifier> extractKeyValueQualifiers(EOQualifier qualifier)
EOKeyValueQualifier
objects
contained within.qualifier
- qualifier to analyzepublic static EOQualifier replaceQualifierWithQualifier(EOQualifier qualifier, EOQualifier searchFor, EOQualifier replaceWith)
qualifier
- the qualifier to modifysearchFor
- the qualifier to replacereplaceWith
- the qualifier that replaces the searched onepublic static EOQualifier matchingValues(Object... values)
An IllegalArgumentException is thrown if objects are not of the right type or if a bad sequence is used, such as a sequence of String-Object-Object or String-String-String.
See er.extensions.eof.ERXEOControlUtilitiesTest in the ERXTest project for details.
values
- a list of objects that can be used to create an EOQualifier. An NSDictionary or EOQualifier can stand alone in the
list. A String or ERXKey must be followed by an Object.Copyright © 2002 – 2024 Project Wonder.