public class Order<E,T extends Comparable<T>> extends Object implements Comparator<E>
Order represents a sorting order for Acid Houses' typesafe "Command
builder API".
You can get Order instance from metamodel property and can pass to
GetList and GetScalar. As an example:
import org.eiichiro.acidhouse.Session;
import org.eiichiro.acidhouse.appengine.AppEngineDatastoreSession;
...
// Create 'Session' instance.
Session session = new AppEngineDatastoreSession();
// Get metamodel instance of 'Entity3' class.
Entity3_ entity3_ = Metamodels.metamodel(Entity3.class);
// Get all 'Entity3' entities sorted by 'entity1.i' property in descending
// order and 'i' property in descending order.
List<Entity3> entity3s = session.get(entity3_)
.sort(entity3_.entity1.i.desc, entity3_.i.desc)
.execute();
ComparableProperty,
GetList,
GetScalar| Modifier and Type | Class and Description |
|---|---|
static class |
Order.Direction
Direction represents a sorting direction. |
| Constructor and Description |
|---|
Order(ComparableProperty<E,T> property,
Order.Direction direction)
Constructs a new
Order instance with the specified
ComparableProperty and sorting direction. |
| Modifier and Type | Method and Description |
|---|---|
int |
compare(E entity1,
E entity2)
Compares the specified two entities.
|
Order.Direction |
direction()
Returns sorting direction.
|
ComparableProperty<E,T> |
property()
Returns
ComparableProperty to be sorted. |
String |
toString()
Returns the custom string representation.
|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, waitequalspublic Order(ComparableProperty<E,T> property, Order.Direction direction)
Order instance with the specified
ComparableProperty and sorting direction.property - ComparableProperty to be sorted.direction - The sorting direction.public ComparableProperty<E,T> property()
ComparableProperty to be sorted.ComparableProperty to be sorted.public Order.Direction direction()
public int compare(E entity1, E entity2)
compare in interface Comparator<E>entity1 - An entity to be compared.entity2 - An entity to be compared.Copyright © 2009-2014 Eiichiro Uchiumi. All Rights Reserved.