Skip to content

Commit

Permalink
Extend the .dot() method to take EOQualifier, EOSortOrdering and NSAr…
Browse files Browse the repository at this point in the history
…ray<EOSortOrdering> to be synonyms for the prefix() methods. This overloading of #dot() makes prefixing existing EOQualifiers, EOSortOrdering and ERXSortOrderings much more intuitive. For example, let's say Company has a complex array of EOSortOrderings that takes into account things like outstanding invoice amounts, days past due, etc that is expressed in a static field called Company.FINANCIAL_SORT. With the dot() method you could easily create a new array of EOSortOrderings for the Invoice entity by simply writing: Invoice.COMPANY.dot(Company.FINANCIAL_SORT).then(Invoice.DUE_DATE). This allows each Entity to know about it's own EOSortOrderings and you don't have to have EOSortOrderings duplicated in every class (or component) that needs to do a sort.
  • Loading branch information
avendasora authored and Pascal Robert committed May 1, 2012
1 parent ffd3d1c commit c149d8c
Showing 1 changed file with 36 additions and 0 deletions.
36 changes: 36 additions & 0 deletions Frameworks/Core/ERExtensions/Sources/er/extensions/eof/ERXKey.java
Original file line number Diff line number Diff line change
Expand Up @@ -2183,4 +2183,40 @@ public ERXSortOrderings prefix(NSArray<EOSortOrdering> sortOrderings) {
}
return prefixedSortOrderings;
}

/**
* Simple cover method for {@link #prefix(EOQualifier)}.
*
* @param qualifier
* the qualifier to prefix
* @return a qualifier with all of its keys prefixed with this key
* @author David Avendasora
*/
public EOQualifier dot(EOQualifier qualifier) {
return prefix(qualifier);
}

/**
* Simple cover method for {@link #prefix(EOSortOrdering)}.
*
* @param sortOrdering
* the sort ordering to prefix
* @return a sort ordering with its key prefixed with this key
* @author David Avendasora
*/
public ERXSortOrdering dot(EOSortOrdering sortOrdering) {
return prefix(sortOrdering);
}

/**
* Simple cover method for {@link #prefix(NSArray)}.
*
* @param sortOrderings
* an Array of sort orderings to prefix
* @return a sort ordering with its key prefixed with this key
* @author David Avendasora
*/
public ERXSortOrderings dot(NSArray<EOSortOrdering> sortOrderings) {
return prefix(sortOrderings);
}
}

0 comments on commit c149d8c

Please sign in to comment.