com.googlecode.genericdao.search
Class Sort

java.lang.Object
  extended by com.googlecode.genericdao.search.Sort
All Implemented Interfaces:
Serializable

public class Sort
extends Object
implements Serializable

Used to specify field ordering in Search.

See Also:
Search, Serialized Form

Field Summary
protected  boolean customExpression
           
protected  boolean desc
           
protected  boolean ignoreCase
           
protected  String property
           
 
Constructor Summary
Sort()
           
Sort(boolean isCustomExpression, String property)
          If isCustomExpression is true, the "property" of this Sort is reckoned as a free-form JPQL/HQL order-by expression.
Sort(boolean isCustomExpression, String property, boolean desc)
          If isCustomExpression is true, the "property" of this Sort is reckoned as a free-form JPQL/HQL order-by expression.
Sort(String property)
           
Sort(String property, boolean desc)
           
Sort(String property, boolean desc, boolean ignoreCase)
           
 
Method Summary
static Sort asc(String property)
           
static Sort asc(String property, boolean ignoreCase)
           
static Sort customExpressionAsc(String expression)
          Instead of a property for this Sort, use a free-form JPQL/HQL order-by expression.
static Sort customExpressionDesc(String expression)
          Instead of a property for this Sort, use a free-form JPQL/HQL order-by expression.
static Sort desc(String property)
           
static Sort desc(String property, boolean ignoreCase)
           
 boolean equals(Object obj)
           
 String getProperty()
          Property on which to sort
 int hashCode()
           
 boolean isCustomExpression()
          If true, the "property" of this Sort is reckoned as a free-form JPQL/HQL order-by expression.
 boolean isDesc()
          If true, sort descending by the given property; otherwise, sort ascending.
 boolean isIgnoreCase()
          If true the ordering will be case insensitive for this property.
 void setCustomExpression(boolean customExpression)
          If true, the "property" of this Sort is reckoned as a free-form JPQL/HQL order-by expression.
 void setDesc(boolean desc)
          If true, sort descending by the given property; otherwise, sort ascending.
 void setIgnoreCase(boolean ignoreCase)
          If true the ordering will be case insensitive for this property.
 void setProperty(String property)
          Property on which to sort
 String toString()
           
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
 

Field Detail

property

protected String property

desc

protected boolean desc

ignoreCase

protected boolean ignoreCase

customExpression

protected boolean customExpression
Constructor Detail

Sort

public Sort()

Sort

public Sort(String property,
            boolean desc,
            boolean ignoreCase)

Sort

public Sort(String property,
            boolean desc)

Sort

public Sort(String property)

Sort

public Sort(boolean isCustomExpression,
            String property,
            boolean desc)
If isCustomExpression is true, the "property" of this Sort is reckoned as a free-form JPQL/HQL order-by expression. Reference properties by wrapping them with curly braces ({}).

Here are some examples:

 new Sort(true, "cast({employeeno} as integer)");
 new Sort(true, "abs({prop1} - {prop2})");
 


Sort

public Sort(boolean isCustomExpression,
            String property)
If isCustomExpression is true, the "property" of this Sort is reckoned as a free-form JPQL/HQL order-by expression. Reference properties by wrapping them with curly braces ({}).

Here are some examples:

 new Sort(true, "cast({employeeno} as integer)", true);
 new Sort(true, "abs({prop1} - {prop2})", true);
 

Method Detail

asc

public static Sort asc(String property)

asc

public static Sort asc(String property,
                       boolean ignoreCase)

desc

public static Sort desc(String property)

desc

public static Sort desc(String property,
                        boolean ignoreCase)

customExpressionAsc

public static Sort customExpressionAsc(String expression)
Instead of a property for this Sort, use a free-form JPQL/HQL order-by expression. Reference properties by wrapping them with curly braces ({}).

Here are some examples:

 Sort.customExpressionAsc("cast({employeeno} as integer)");
 Sort.customExpressionAsc("abs({prop1} - {prop2})");
 


customExpressionDesc

public static Sort customExpressionDesc(String expression)
Instead of a property for this Sort, use a free-form JPQL/HQL order-by expression. Reference properties by wrapping them with curly braces ({}).

Here are some examples:

 Sort.customExpressionDesc("cast({employeeno} as integer)");
 Sort.customExpressionDesc("abs({prop1} - {prop2})");
 


getProperty

public String getProperty()
Property on which to sort


setProperty

public void setProperty(String property)
Property on which to sort


isDesc

public boolean isDesc()
If true, sort descending by the given property; otherwise, sort ascending.


setDesc

public void setDesc(boolean desc)
If true, sort descending by the given property; otherwise, sort ascending.


isIgnoreCase

public boolean isIgnoreCase()
If true the ordering will be case insensitive for this property. Ignore case has no effect when customExpression is specified.


setIgnoreCase

public void setIgnoreCase(boolean ignoreCase)
If true the ordering will be case insensitive for this property. Ignore case has no effect when customExpression is specified.


isCustomExpression

public boolean isCustomExpression()

If true, the "property" of this Sort is reckoned as a free-form JPQL/HQL order-by expression. Reference properties by wrapping them with curly braces ({}).

When set to true, the ignoreCase property is ignored.

Here are some examples:

 new Sort(true, "cast({employeeno} as integer)");
 new Sort(true, "abs({prop1} - {prop2})", true);
 Sort.ascCustom("cast({employeeno} as integer)");
 Sort.descCustom("abs({prop1} - {prop2})");
 


setCustomExpression

public void setCustomExpression(boolean customExpression)

If true, the "property" of this Sort is reckoned as a free-form JPQL/HQL order-by expression. Reference properties by wrapping them with curly braces ({}).

When set to true, the ignoreCase property is ignored.

Here are some examples:

 new Sort(true, "cast({employeeno} as integer)");
 new Sort(true, "abs({prop1} - {prop2})", true);
 Sort.ascCustom("cast({employeeno} as integer)");
 Sort.descCustom("abs({prop1} - {prop2})");
 


hashCode

public int hashCode()
Overrides:
hashCode in class Object

equals

public boolean equals(Object obj)
Overrides:
equals in class Object

toString

public String toString()
Overrides:
toString in class Object


Copyright © 2008-2011. All Rights Reserved.