|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectorg.sqlproc.engine.SqlOrder
public class SqlOrder
The list of ordering directives for the SQL Processor queries execution. The class layout is based on the Composite design pattern. Instances of this class can be obtained only using one of the factory methods.
For example there's a table PERSON with two columns - ID and NAME. The META SQL can be the next one:
LIST_ALL_SQL= \ select p.ID, p.NAME \ from PERSON p \ {#1 order by ID} \ {#2 order by NAME}
In the case of SQL Processor invocation
SqlEngine sqlEngine = sqlLoader.getSqlEngine("ALL"); List<Person> list = sqlEngine.query(session, Person.class, null, SqlOrder.getAscOrder(1));the output list is sorted in ascending order based on column ID.
In the case of SQL Processor invocation
SqlEngine sqlEngine = sqlLoader.getSqlEngine("ALL"); List<Person> list = sqlEngine.query(session, Person.class, new Object(), SqlOrder.getDescOrder(2));the output list is sorted in descending order based on column NAME.
For more info please see the User's tutorial.
Nested Class Summary | |
---|---|
static class |
SqlOrder.Order
The enumeration for the ordering directives. |
Field Summary | |
---|---|
private SqlOrder.Order |
orderDirrection
The ordering direction (no ordering, ascending or descending). |
private int |
orderId
The ordering id. |
private java.util.List<SqlOrder> |
orders
The list of all ordering rules. |
Constructor Summary | |
---|---|
private |
SqlOrder()
Creates a new empty ordering directives. |
private |
SqlOrder(int orderId,
SqlOrder.Order orderDirrection)
/** Creates a new ordering rule. |
Method Summary | |
---|---|
SqlOrder |
addAscOrder(int orderId)
Adds one more ascending ordering rule into the list of ordering directives. |
SqlOrder |
addDescOrder(int orderId)
Adds one more descending ordering rule into the list of ordering directives. |
SqlOrder |
addOrder(int orderId)
Adds one more ascending or descending ordering rule into the list of ordering directives. |
static SqlOrder |
getAscOrder(int orderId)
The factory method. |
static SqlOrder |
getDescOrder(int orderId)
The factory method. |
static SqlOrder |
getOrder()
The factory method. |
static SqlOrder |
getOrder(int orderId)
The factory method. |
SqlOrder.Order |
getOrderDirrection()
Returns the ordering direction (no ordering, ascending or descending). |
int |
getOrderId()
Returns the ordering id. |
java.util.List<SqlOrder> |
getOrders()
Returns the list of ordering directives. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
private int orderId
private SqlOrder.Order orderDirrection
private java.util.List<SqlOrder> orders
Constructor Detail |
---|
private SqlOrder()
private SqlOrder(int orderId, SqlOrder.Order orderDirrection)
orderId
- the ordering idorderDirrection
- the ordering directionMethod Detail |
---|
public static SqlOrder getOrder()
public static SqlOrder getAscOrder(int orderId)
orderId
- the ordering id
public static SqlOrder getDescOrder(int orderId)
orderId
- the ordering id
public static SqlOrder getOrder(int orderId)
orderId
- the ordering id. Can be a negative one for a descending ordering rule.
public SqlOrder addAscOrder(int orderId)
orderId
- the ordering id
public SqlOrder addDescOrder(int orderId)
orderId
- the ordering id
public SqlOrder addOrder(int orderId)
orderId
- the ordering id. Can be a negative one for a descending ordering rule.
public int getOrderId()
public SqlOrder.Order getOrderDirrection()
public java.util.List<SqlOrder> getOrders()
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |