Class OrderBy
java.lang.Object
ece.ing3.java.projet.database.sql.clauses.OrderBy
Order By clause helper.
Provides a convenient way to build Order By clause, reactive-style. Nesting is not allowed.
Order By clauses can be chained using and(OrderBy)
or the shortcut method and(String, Order)
, to avoid creating unnecessary Order By clauses.
OrderBy supports Reactive-style programming to create more compact code.
As such,
OrderBy o = new OrderBy( "col1", Order.DESC ); o.and( "col2", Order.ASC ); String v = o.toString();
can be written
String v = ( new OrderBy( "col1", Order.DESC ) ).and( "col2", Order.ASC ).toString();
- Author:
- Virgile, Nicolas, Louis-Félix
-
Constructor Summary
Constructors -
Method Summary
-
Constructor Details
-
OrderBy
public OrderBy()Creates a new chainable, empty Order By clause. -
OrderBy
Creates a new chainable Order By clause.- Parameters:
column
- Column to targetorder
- Order to target
-
-
Method Details
-
and
Chain another Order By condition.- Parameters:
condition
- Condition to chain- Returns:
- This Order By clause helper
-
and
Chain another Order By condition using the provided values.- Parameters:
column
- Column to targetorder
- Order to target- Returns:
- This Order By clause helper
-
toString
Gets the corresponding SQL Order By clause.
-