…Hugi still uses that subclass—and is still a WO guy :). The class in question 
is rather simple and really just a Cayenne-ized version of ERXSortOrdering. 
Quite convenient.

https://bitbucket.org/hugi/jambalaya/src/4a0b939d5a4e5d82f124cc46439a4cd6803efcd1/src/main/java/com/eplica/jambalaya/ChainableOrdering.java

- hugi


On 1.8.2013, at 18:47, John Huss <[email protected]> wrote:

> I'm not using it right now, but a good while ago Hugi, a former WO guy, 
> posted a subclass called ChainableOrdering that added a few methods that 
> provided a more fluent API for combining Orderings.  I had changed 
> Ordering.orderList to accept subclasses, but not SelectQuery, so it seemed 
> good to make it consistent as well.  Anyway, you never know what someone 
> might come up with.
> 
> 
> On Thu, Aug 1, 2013 at 12:21 PM, Andrus Adamchik <[email protected]> 
> wrote:
> Not that I have any objections, but I am wondering what good does it do for 
> you to subclass Ordering?
> 
> Andrus
> 
> 
> On Aug 1, 2013, at 6:03 PM, [email protected] wrote:
> 
> > Author: johnthuss
> > Date: Thu Aug  1 15:03:33 2013
> > New Revision: 1509274
> >
> > URL: http://svn.apache.org/r1509274
> > Log:
> > Allow an Ordering subclass to be used where Ordering is accepted
> >
> > Modified:
> >    
> > cayenne/main/trunk/framework/cayenne-core-unpublished/src/main/java/org/apache/cayenne/query/SelectQuery.java
> >
> > Modified: 
> > cayenne/main/trunk/framework/cayenne-core-unpublished/src/main/java/org/apache/cayenne/query/SelectQuery.java
> > URL: 
> > http://svn.apache.org/viewvc/cayenne/main/trunk/framework/cayenne-core-unpublished/src/main/java/org/apache/cayenne/query/SelectQuery.java?rev=1509274&r1=1509273&r2=1509274&view=diff
> > ==============================================================================
> > --- 
> > cayenne/main/trunk/framework/cayenne-core-unpublished/src/main/java/org/apache/cayenne/query/SelectQuery.java
> >  (original)
> > +++ 
> > cayenne/main/trunk/framework/cayenne-core-unpublished/src/main/java/org/apache/cayenne/query/SelectQuery.java
> >  Thu Aug  1 15:03:33 2013
> > @@ -91,7 +91,7 @@ public class SelectQuery<T> extends Qual
> >      *
> >      * @since 3.2
> >      */
> > -    public static <T> SelectQuery<T> query(Class<T> rootClass, Expression 
> > qualifier, List<Ordering> orderings) {
> > +    public static <T> SelectQuery<T> query(Class<T> rootClass, Expression 
> > qualifier, List<? extends Ordering> orderings) {
> >         return new SelectQuery<T>(rootClass, qualifier, orderings);
> >     }
> >
> > @@ -173,7 +173,7 @@ public class SelectQuery<T> extends Qual
> >      *            defines how to order the results, may be null.
> >      * @since 3.1
> >      */
> > -    public SelectQuery(ObjEntity root, Expression qualifier, 
> > List<Ordering> orderings) {
> > +    public SelectQuery(ObjEntity root, Expression qualifier, List<? 
> > extends Ordering> orderings) {
> >         this();
> >         this.init(root, qualifier);
> >         addOrderings(orderings);
> > @@ -215,7 +215,7 @@ public class SelectQuery<T> extends Qual
> >      *            defines how to order the results, may be null.
> >      * @since 3.1
> >      */
> > -    public SelectQuery(Class<T> rootClass, Expression qualifier, 
> > List<Ordering> orderings) {
> > +    public SelectQuery(Class<T> rootClass, Expression qualifier, List<? 
> > extends Ordering> orderings) {
> >         init(rootClass, qualifier);
> >         addOrderings(orderings);
> >     }
> > @@ -257,7 +257,7 @@ public class SelectQuery<T> extends Qual
> >      *            defines how to order the results, may be null.
> >      * @since 3.1
> >      */
> > -    public SelectQuery(DbEntity root, Expression qualifier, List<Ordering> 
> > orderings) {
> > +    public SelectQuery(DbEntity root, Expression qualifier, List<? extends 
> > Ordering> orderings) {
> >         this();
> >         this.init(root, qualifier);
> >         addOrderings(orderings);
> > @@ -290,7 +290,7 @@ public class SelectQuery<T> extends Qual
> >      *            defines how to order the results, may be null.
> >      * @since 3.1
> >      */
> > -    public SelectQuery(String objEntityName, Expression qualifier, 
> > List<Ordering> orderings) {
> > +    public SelectQuery(String objEntityName, Expression qualifier, List<? 
> > extends Ordering> orderings) {
> >         init(objEntityName, qualifier);
> >         addOrderings(orderings);
> >     }
> > @@ -497,7 +497,7 @@ public class SelectQuery<T> extends Qual
> >     /**
> >      * Adds a list of orderings.
> >      */
> > -    public void addOrderings(List<Ordering> orderings) {
> > +    public void addOrderings(List<? extends Ordering> orderings) {
> >         // If the supplied list of orderings is null, do not attempt to add
> >         // to the collection (addAll() will NPE otherwise).
> >         if (orderings != null)
> >
> >
> >
> 
> 

Reply via email to