ERXQ Class Reference

Collaboration diagram for ERXQ:

Collaboration graph
[legend]

List of all members.

Static Public Member Functions

static ERXAndQualifier and (NSArray<?extends EOQualifier > qualifiers)
static ERXAndQualifier and (EOQualifier...qualifiersArray)
static EOQualifier between (String key, Object lowerBound, Object upperBound, boolean inclusive)
static EOQualifier between (String key, Object lowerBound, Object upperBound)
static ERXKeyValueQualifier compare (String key, NSSelector operator, Object value)
static ERXKeyValueQualifier contains (String key, String value)
static ERXAndQualifier containsAll (String key, String[] tokens)
static ERXAndQualifier containsAll (String key, String tokensWithWhitespace)
static ERXOrQualifier containsAll (NSArray< String > keys, String tokensWithWhitespace)
static ERXAndQualifier containsAllInAny (String[] keys, String[] tokens)
static ERXAndQualifier containsAllInAny (String[] keys, String tokensWithWhitespace)
static ERXOrQualifier containsAny (String key, String[] tokens)
static ERXOrQualifier containsAny (String key, String tokensWithWhitespace)
static ERXOrQualifier containsAny (NSArray< String > keys, String tokensWithWhitespace)
static ERXKeyValueQualifier containsObject (String key, Object value)
static ERXKeyValueQualifier endsWith (String key, String value)
static ERXKeyValueQualifier endsWithInsensitive (String key, String value)
static< T >
ERXKeyComparisonQualifier 
equals (ERXKey< T > key, ERXKey< T > value)
static ERXKeyValueQualifier equals (String key, Object value)
static void filter (NSMutableArray<?> array, EOQualifier qualifier)
static< T > NSArray< T > filtered (NSArray< T > array, EOQualifier qualifier)
static< T > T first (NSArray< T > array, EOQualifier qualifier)
static< T >
ERXKeyComparisonQualifier 
greaterThan (ERXKey< T > key, ERXKey< T > value)
static ERXKeyValueQualifier greaterThan (String key, Object value)
static< T >
ERXKeyComparisonQualifier 
greaterThanOrEqualTo (ERXKey< T > key, ERXKey< T > value)
static ERXKeyValueQualifier greaterThanOrEqualTo (String key, Object value)
static ERXKeyValueQualifier has (String key, NSArray values)
static ERXKeyValueQualifier hasAtLeast (String key, NSArray values, int min)
static ERXKeyValueQualifier hasValues (String key, NSArray values)
static ERXOrQualifier in (String key, NSArray<?> values)
static ERXOrQualifier inObjects (String key, Object...values)
static ERXKeyValueQualifier is (String key, Object value)
static ERXKeyValueQualifier isFalse (String key)
static ERXKeyValueQualifier isNotNull (String key)
static ERXKeyValueQualifier isNull (String key)
static ERXKeyValueQualifier isNull (String key, boolean yesOrNo)
static ERXKeyValueQualifier isTrue (String key)
static String keyPath (String...elements)
static< T >
ERXKeyComparisonQualifier 
lessThan (ERXKey< T > key, ERXKey< T > value)
static ERXKeyValueQualifier lessThan (String key, Object value)
static< T >
ERXKeyComparisonQualifier 
lessThanOrEqualTo (ERXKey< T > key, ERXKey< T > value)
static ERXKeyValueQualifier lessThanOrEqualTo (String key, Object value)
static ERXKeyValueQualifier like (String key, Object value)
static ERXKeyValueQualifier likeInsensitive (String key, Object value)
static ERXKeyValueQualifier matches (String key, String value)
static ERXNotQualifier not (EOQualifier qualifier)
static< T >
ERXKeyComparisonQualifier 
notEquals (ERXKey< T > key, ERXKey< T > value)
static ERXKeyValueQualifier notEquals (String key, Object value)
static ERXAndQualifier notIn (String key, NSArray values)
static< T > T one (NSArray< T > array, EOQualifier qualifier)
static ERXOrQualifier or (NSArray<?extends EOQualifier > qualifiers)
static ERXOrQualifier or (EOQualifier...qualifiersArray)
static< T > T requiredOne (NSArray< T > array, EOQualifier qualifier)
static ERXKeyValueQualifier startsWith (String key, String value)
static ERXKeyValueQualifier startsWithInsensitive (String key, String value)

Static Public Attributes

static final NSSelector CONTAINS = EOQualifier.QualifierOperatorContains
static final NSSelector EQ = EOQualifier.QualifierOperatorEqual
static final NSSelector GT = EOQualifier.QualifierOperatorGreaterThan
static final NSSelector GTEQ = EOQualifier.QualifierOperatorGreaterThanOrEqualTo
static final NSSelector ILIKE = EOQualifier.QualifierOperatorCaseInsensitiveLike
static final NSSelector LIKE = EOQualifier.QualifierOperatorLike
static final NSSelector LT = EOQualifier.QualifierOperatorLessThan
static final NSSelector LTEQ = EOQualifier.QualifierOperatorLessThanOrEqualTo
static final NSSelector NE = EOQualifier.QualifierOperatorNotEqual


Detailed Description

ERXQ provides lots of much shorter methods of constructing EOQualifiers than the very verbose style that you normally have to use. For instance ...

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"));

Author:
mschrag

Member Function Documentation

static ERXAndQualifier and ( NSArray<?extends EOQualifier >  qualifiers  )  [static]

Equivalent to new ERXAndQualifier(new NSArray(qualifiersArray).

Parameters:
qualifiers the NSArray of qualifiers to and
Returns:
an ERXAndQualifier

static ERXAndQualifier and ( EOQualifier...  qualifiersArray  )  [static]

Equivalent to new ERXAndQualifier(new NSArray(qualifiersArray). Nulls are skipped.

Parameters:
qualifiersArray the array of qualifiers to and
Returns:
and EOAndQualifier

static EOQualifier between ( String  key,
Object  lowerBound,
Object  upperBound,
boolean  inclusive 
) [static]

Equivalent to key >= lowerBound and key <= upperBound (inclusive). Not that this does not return an ERXBetweenQualifier.

Parameters:
key the key
lowerBound the lower bound value
upperBound the upper bound value
Returns:
the qualifier

static EOQualifier between ( String  key,
Object  lowerBound,
Object  upperBound 
) [static]

Equivalent to key > lowerBound and key < upperBound (exclusive). Not that this does not return an ERXBetweenQualifier.

Parameters:
key the key
lowerBound the lower bound value
upperBound the upper bound value
Returns:
the qualifier

static ERXKeyValueQualifier compare ( String  key,
NSSelector  operator,
Object  value 
) [static]

Equivalent to new ERXKeyValueQualifier(key, operator, value);

Parameters:
key the key
operator ERXQ.EQ, NE, GT, LT, etc
value the value
Returns:
an EOKeyValueQualifier

static ERXKeyValueQualifier contains ( String  key,
String  value 
) [static]

Equivalent to new ERXKeyValueQualifier(key, EOQualifier.OperatorCaseInsensitiveLike, "*" + value + "*").

Parameters:
key the key
value the substring value
Returns:
an EOKeyValueQualifier

static ERXAndQualifier containsAll ( String  key,
String[]  tokens 
) [static]

Returns a qualifier that evalutes to true when the value of the given key contains all of the given tokens (insensitively).

Parameters:
key the key
tokens the list of tokens to search for
Returns:
an ERXAndQualifier

static ERXAndQualifier containsAll ( String  key,
String  tokensWithWhitespace 
) [static]

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. The search string will be tokenized by splitting on space characters.

Parameters:
key the key
tokensWithWhitespace a whitespace separated list of tokens to search for
Returns:
an ERXAndQualifier

static ERXOrQualifier containsAll ( NSArray< String keys,
String  tokensWithWhitespace 
) [static]

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. The search string will be tokenized by splitting on space characters.

Parameters:
keys the keys
tokensWithWhitespace a whitespace separated list of tokens to search for
Returns:
an ERXOrQualifier

static ERXAndQualifier containsAllInAny ( String[]  keys,
String[]  tokens 
) [static]

Returns a qualifier that evaluates to true when all values in the given tokens are found when searching across any of the keypaths. As an example, you could search for "Mike Schrag" across the keys (firstName, lastName) and it would find (firstName=Mike or lastName=Mike) and (firstName=Schrag or lastName=Schrag). Be careful of this one as it permutes quickly.

Parameters:
keys keypaths to perform search in
tokens tokens to search for
Returns:
an ERXAndQualifier

static ERXAndQualifier containsAllInAny ( String[]  keys,
String  tokensWithWhitespace 
) [static]

Returns a qualifier that evaluates to true when all values in the given tokens are found when searching across any of the keypaths. As an example, you could search for "Mike Schrag" across the keys (firstName, lastName) and it would find (firstName=Mike or lastName=Mike) and (firstName=Schrag or lastName=Schrag). Be careful of this one as it permutes quickly.

Parameters:
keys keypaths to perform search in
tokensWithWhitespace tokens to search for
Returns:
an ERXAndQualifier

static ERXOrQualifier containsAny ( String  key,
String[]  tokens 
) [static]

Returns a qualifier that evalutes to true when the value of the given key contains any of the given tokens (insensitively).

Parameters:
key the key
tokens the list of tokens to search for
Returns:
an ERXOrQualifier

static ERXOrQualifier containsAny ( String  key,
String  tokensWithWhitespace 
) [static]

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. The search string will be tokenized by splitting on space characters.

Parameters:
key the key
tokensWithWhitespace a whitespace separated list of tokens to search for
Returns:
an ERXOrQualifier

static ERXOrQualifier containsAny ( NSArray< String keys,
String  tokensWithWhitespace 
) [static]

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. The search string will be tokenized by splitting on space characters.

Parameters:
keys the keys
tokensWithWhitespace a whitespace separated list of tokens to search for
Returns:
an ERXOrQualifier

static ERXKeyValueQualifier containsObject ( String  key,
Object  value 
) [static]

Equivalent to new ERXKeyValueQualifier(key, EOQualifier.OperatorContains, value).

Parameters:
key the key
value the value
Returns:
an EOKeyValueQualifier

static ERXKeyValueQualifier endsWith ( String  key,
String  value 
) [static]

Equivalent to new ERXKeyValueQualifier(key, EOQualifier.OperatorLike, "*" + value).

Parameters:
key the key
value the substring value
Returns:
an EOKeyValueQualifier

static ERXKeyValueQualifier endsWithInsensitive ( String  key,
String  value 
) [static]

Equivalent to new ERXKeyValueQualifier(key, EOQualifier.OperatorCaseInsensitiveLike, "*" + value).

Parameters:
key the key
value the substring value
Returns:
an EOKeyValueQualifier

static <T> ERXKeyComparisonQualifier equals ( ERXKey< T >  key,
ERXKey< T >  value 
) [static]

Equivalent to new ERXKeyComparisonQualifier(key, EOQualifier.QualifierOperatorEqual, value);

Parameters:
key the key
value the value
Returns:
an ERXKeyComparisonQualifier

static ERXKeyValueQualifier equals ( String  key,
Object  value 
) [static]

Equivalent to new ERXKeyValueQualifier(key, EOQualifier.QualifierOperatorEqual, value);

Parameters:
key the key
value the value
Returns:
an EOKeyValueQualifier

static void filter ( NSMutableArray<?>  array,
EOQualifier  qualifier 
) [static]

Equivalent to EOQualifier.filterArrayWithQualifier(NSMutableArray, EOQualfier)

Parameters:
array the array to filter (in place)
qualifier the qualifier to filter with

static <T> NSArray<T> filtered ( NSArray< T >  array,
EOQualifier  qualifier 
) [static]

Equivalent to EOQualifier.filteredArrayWithQualifier(NSArray, EOQualifier)

Parameters:
<T> the type of the array
array the array to filter
qualifier the qualifier to filter with
Returns:
the filtered array

static <T> T first ( NSArray< T >  array,
EOQualifier  qualifier 
) [static]

Returns the first object that matches the qualifier in the given array (or null if there is no match).

Parameters:
<T> the type of the objects
array the array to filter
qualifier the qualifier to filter on
Returns:
one matching object or null
Exceptions:
IllegalStateException if more than one object matched

static <T> ERXKeyComparisonQualifier greaterThan ( ERXKey< T >  key,
ERXKey< T >  value 
) [static]

Equivalent to new ERXKeyComparisonQualifier(key, EOQualifier.QualifierOperatorGreaterThan, value);

Parameters:
key the key
value the value
Returns:
an ERXKeyComparisonQualifier

static ERXKeyValueQualifier greaterThan ( String  key,
Object  value 
) [static]

Equivalent to new ERXKeyValueQualifier(key, EOQualifier.QualifierOperatorGreaterThan, value);

Parameters:
key the key
value the value
Returns:
an EOKeyValueQualifier

static <T> ERXKeyComparisonQualifier greaterThanOrEqualTo ( ERXKey< T >  key,
ERXKey< T >  value 
) [static]

Equivalent to new ERXKeyComparisonQualifier(key, EOQualifier.QualifierOperatorGreaterThanOrEqualTo, value);

Parameters:
key the key
value the value
Returns:
an ERXKeyComparisonQualifier

static ERXKeyValueQualifier greaterThanOrEqualTo ( String  key,
Object  value 
) [static]

Equivalent to new ERXKeyValueQualifier(key, EOQualifier.QualifierOperatorGreaterThanOrEqualTo, value);

Parameters:
key the key
value the value
Returns:
an EOKeyValueQualifier

static ERXKeyValueQualifier has ( String  key,
NSArray  values 
) [static]

Equivalent to new ERXToManyQualifier(key, values);

Parameters:
key the key
values the values
Returns:
an EOKeyValueQualifier

static ERXKeyValueQualifier hasAtLeast ( String  key,
NSArray  values,
int  min 
) [static]

Equivalent to new ERXToManyQualifier(key, values);

Parameters:
key the key
values the values
Returns:
an EOKeyValueQualifier

static ERXKeyValueQualifier hasValues ( String  key,
NSArray  values 
) [static]

Equivalent to new ERXInQualifier(key, values);

Parameters:
key the key
values the values
Returns:
an EOKeyValueQualifier

static ERXOrQualifier in ( String  key,
NSArray<?>  values 
) [static]

Equivalent to a new ERXOrQualifier of EOKeyValueQualifier with key equals value for each value.

Parameters:
key the key
values the values
Returns:
an EOQualifier

static ERXOrQualifier inObjects ( String  key,
Object...  values 
) [static]

Equivalent to a new ERXOrQualifier of EOKeyValueQualifier with key equals value for each value.

Parameters:
key the key
values the values
Returns:
an EOQualifier

static ERXKeyValueQualifier is ( String  key,
Object  value 
) [static]

Equivalent to new ERXKeyValueQualifier(key, EOQualifier.QualifierOperatorEqual, value);

Parameters:
key the key
value the value
Returns:
an EOKeyValueQualifier

static ERXKeyValueQualifier isFalse ( String  key  )  [static]

Equivalent to new ERXKeyValueQualifier(key, EOQualifier.QualifierOperatorEqual, Boolean.FALSE);

Parameters:
key the key
Returns:
an EOKeyValueQualifier

static ERXKeyValueQualifier isNotNull ( String  key  )  [static]

Equivalent to new ERXKeyValueQualifier(key, EOQualifier.QualifierOperatorNotEqual, null);

Parameters:
key the key
Returns:
an EOKeyValueQualifier

static ERXKeyValueQualifier isNull ( String  key  )  [static]

Equivalent to new ERXKeyValueQualifier(key, EOQualifier.QualifierOperatorEqual, null);

Parameters:
key the key
Returns:
an EOKeyValueQualifier

static ERXKeyValueQualifier isNull ( String  key,
boolean  yesOrNo 
) [static]

Returns isNull or isNotNull depending on the value of yesOrNo.

Parameters:
key the key
yesOrNo if true, returns isNull, if false, returns isNotNull
Returns:
the EOKeyValueQualifier

static ERXKeyValueQualifier isTrue ( String  key  )  [static]

Equivalent to new ERXKeyValueQualifier(key, EOQualifier.QualifierOperatorEqual, Boolean.TRUE);

Parameters:
key the key
Returns:
an EOKeyValueQualifier

static String keyPath ( String...  elements  )  [static]

Generates a key path from a var args list of strings. Reduces this mess:

 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));
 

Parameters:
elements one or more string to concatenate into a keyPath
Returns:
elements with "." between them to form a keypath

static <T> ERXKeyComparisonQualifier lessThan ( ERXKey< T >  key,
ERXKey< T >  value 
) [static]

Equivalent to new ERXKeyComparisonQualifier(key, EOQualifier.QualifierOperatorLessThan, value);

Parameters:
key the key
value the value
Returns:
an ERXKeyComparisonQualifier

static ERXKeyValueQualifier lessThan ( String  key,
Object  value 
) [static]

Equivalent to new ERXKeyValueQualifier(key, EOQualifier.QualifierOperatorLessThan, value);

Parameters:
key the key
value the value
Returns:
an EOKeyValueQualifier

static <T> ERXKeyComparisonQualifier lessThanOrEqualTo ( ERXKey< T >  key,
ERXKey< T >  value 
) [static]

Equivalent to new ERXKeyComparisonQualifier(key, EOQualifier.QualifierOperatorLessThanOrEqualTo, value);

Parameters:
key the key
value the value
Returns:
an ERXKeyComparisonQualifier

static ERXKeyValueQualifier lessThanOrEqualTo ( String  key,
Object  value 
) [static]

Equivalent to new ERXKeyValueQualifier(key, EOQualifier.QualifierOperatorLessThanOrEqualTo, value);

Parameters:
key the key
value the value
Returns:
an EOKeyValueQualifier

static ERXKeyValueQualifier like ( String  key,
Object  value 
) [static]

Equivalent to new ERXKeyValueQualifier(key, EOQualifier.QualifierOperatorLike, value);

Parameters:
key the key
value the value
Returns:
an EOKeyValueQualifier

static ERXKeyValueQualifier likeInsensitive ( String  key,
Object  value 
) [static]

Equivalent to new ERXKeyValueQualifier(key, EOQualifier.QualifierOperatorCaseInsensitiveLike, value);

Parameters:
key the key
value the value
Returns:
an EOKeyValueQualifier

static ERXKeyValueQualifier matches ( String  key,
String  value 
) [static]

Equivalent to new ERXRegExQualifier(key, value);

Parameters:
key the key
value the value
Returns:
an EOKeyValueQualifier

static ERXNotQualifier not ( EOQualifier  qualifier  )  [static]

Equivalent to new ERXNotQualifier(qualifier);

Parameters:
qualifier the qualifier to not
Returns:
an EONotQualifier

static <T> ERXKeyComparisonQualifier notEquals ( ERXKey< T >  key,
ERXKey< T >  value 
) [static]

Equivalent to new ERXKeyComparisonQualifier(key, EOQualifier.QualifierOperatorNotEqual, value);

Parameters:
key the key
value the value
Returns:
an ERXKeyComparisonQualifier

static ERXKeyValueQualifier notEquals ( String  key,
Object  value 
) [static]

Equivalent to new ERXKeyValueQualifier(key, EOQualifier.QualifierOperatorNotEqual, value);

Parameters:
key the key
value the value
Returns:
an EOKeyValueQualifier

static ERXAndQualifier notIn ( String  key,
NSArray  values 
) [static]

Equivalent to a new ERXAndQualifier of EONotQualifier(EOKeyValueQualifier) with key equals value for each value.

Parameters:
key the key
values the values
Returns:
an EOQualifier

static <T> T one ( NSArray< T >  array,
EOQualifier  qualifier 
) [static]

Returns the one object that matches the qualifier in the given array (or null if there is no match).

Parameters:
<T> the type of the objects
array the array to filter
qualifier the qualifier to filter on
Returns:
one matching object or null
Exceptions:
IllegalStateException if more than one object matched

static ERXOrQualifier or ( NSArray<?extends EOQualifier >  qualifiers  )  [static]

Equivalent to new ERXOrQualifier(new NSArray(qualifiersArray).

Parameters:
qualifiers the NSArray of qualifiers to or
Returns:
an ERXOrQualifier

static ERXOrQualifier or ( EOQualifier...  qualifiersArray  )  [static]

Equivalent to new ERXOrQualifier(new NSArray(qualifiersArray). Nulls are skipped.

Parameters:
qualifiersArray the array of qualifiers to or
Returns:
and EOOrQualifier

static <T> T requiredOne ( NSArray< T >  array,
EOQualifier  qualifier 
) [static]

Returns the one object that matches the qualifier in the given array (or throws if there is no match).

Parameters:
<T> the type of the objects
array the array to filter
qualifier the qualifier to filter on
Returns:
one matching object
Exceptions:
IllegalStateException if more than one object matched
NoSuchElementException if no objects matched

static ERXKeyValueQualifier startsWith ( String  key,
String  value 
) [static]

Equivalent to new ERXKeyValueQualifier(key, EOQualifier.OperatorLike, value + "*").

Parameters:
key the key
value the substring value
Returns:
an EOKeyValueQualifier

static ERXKeyValueQualifier startsWithInsensitive ( String  key,
String  value 
) [static]

Equivalent to new ERXKeyValueQualifier(key, EOQualifier.OperatorCaseInsensitiveLike, value + "*").

Parameters:
key the key
value the substring value
Returns:
an EOKeyValueQualifier


Member Data Documentation

final NSSelector CONTAINS = EOQualifier.QualifierOperatorContains [static]

Equivalent to EOQualifier.QualifierOperatorContains

final NSSelector EQ = EOQualifier.QualifierOperatorEqual [static]

Equivalent to EOQualifier.QualifierOperatorEqual

final NSSelector GT = EOQualifier.QualifierOperatorGreaterThan [static]

Equivalent to EOQualifier.QualifierOperatorGreaterThan

final NSSelector GTEQ = EOQualifier.QualifierOperatorGreaterThanOrEqualTo [static]

Equivalent to EOQualifier.QualifierOperatorGreaterThanOrEqualTo

final NSSelector ILIKE = EOQualifier.QualifierOperatorCaseInsensitiveLike [static]

Equivalent to EOQualifier.QualifierOperatorCaseInsensitiveLike

final NSSelector LIKE = EOQualifier.QualifierOperatorLike [static]

Equivalent to EOQualifier.QualifierOperatorLike

final NSSelector LT = EOQualifier.QualifierOperatorLessThan [static]

Equivalent to EOQualifier.QualifierOperatorLessThan

final NSSelector LTEQ = EOQualifier.QualifierOperatorLessThanOrEqualTo [static]

Equivalent to EOQualifier.QualifierOperatorLessThanOrEqualTo

final NSSelector NE = EOQualifier.QualifierOperatorNotEqual [static]

Equivalent to EOQualifier.QualifierOperatorNotEqual


The documentation for this class was generated from the following file:

Generated on Sat May 26 06:43:11 2012 for Project Wonder by  doxygen 1.5.8