package +zoccolo+.jpa; import java.util.ArrayList; import java.util.List; public class OrderBuilder { public static enum OrderType { ASC("asc"), DESC("desc"); private String value; private OrderType(String value) { this.value = value; } @Override public String toString() { return this.value.toString(); } } private List orders; public OrderBuilder() { orders = new ArrayList(); } public OrderBuilder add(final String order) { orders.add(new Order() { public String getOrder() { return order; } public String getAsc() { return OrderType.ASC.toString(); } }); return this; } public OrderBuilder add(final String order, final String asc) { orders.add(new Order() { public String getOrder() { return order; } public String getAsc() { return asc; } }); return this; } public List getOrders() { return orders; } public Order[] toArray() { return orders.toArray(new Order[] {}); } }