Package com.im.df.api.support
Class SortDirective
- java.lang.Object
-
- com.im.df.api.support.SortDirective
-
public final class SortDirective extends java.lang.Object
The sorting definition for aDFDataTree
. The sorting definition is based on a list offields
with their designated ordering. The ordering is defined as aboolean
flag;true
means the ascending order andfalse
means the descending order. Each pair of aDFField
and the ordering flag is represented as aSortDirective.Item
.Instances of this class are immutable.
- Author:
- Petr Hamernik
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static class
SortDirective.Item
A single item in aSortDirective
.
-
Field Summary
Fields Modifier and Type Field Description static SortDirective
EMPTY
An emptySortDirective
.static java.lang.String
SQL_ASC
Constant for ascending sort order when determining defaultSortDirective
for an entity.static java.lang.String
SQL_DESC
Constant for descending sort order when determining defaultSortDirective
for an entity.
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description static SortDirective
create(DFField[] fields, boolean[] ascendings)
static SortDirective
create(DFField field, boolean ascending)
boolean
equals(java.lang.Object obj)
java.util.List<DFField>
getFields()
Gets allfields
used in thisSortDirective
.DBSchemaCapability.NullPositionAfterOrdering
getNullPositionAfterOrdering()
java.util.List<SortDirective.Item>
getSorts()
Gets allitems
used in thisSortDirective
.int
hashCode()
static SortDirective
merge(SortDirective sort, DFField field, boolean ascending)
static SortDirective
parse(DFEntity entity, java.lang.String value)
static SortDirective
removeFields(SortDirective sort, java.lang.Iterable<? extends DFField> fields)
Removesfields
fromSortDirective
.java.lang.String
toString()
-
-
-
Field Detail
-
SQL_ASC
public static final java.lang.String SQL_ASC
Constant for ascending sort order when determining defaultSortDirective
for an entity.- See Also:
- Constant Field Values
-
SQL_DESC
public static final java.lang.String SQL_DESC
Constant for descending sort order when determining defaultSortDirective
for an entity.- See Also:
- Constant Field Values
-
EMPTY
public static final SortDirective EMPTY
An emptySortDirective
.
-
-
Method Detail
-
getNullPositionAfterOrdering
public DBSchemaCapability.NullPositionAfterOrdering getNullPositionAfterOrdering()
-
create
public static SortDirective create(DFField field, boolean ascending)
-
create
public static SortDirective create(DFField[] fields, boolean[] ascendings)
-
parse
public static SortDirective parse(DFEntity entity, java.lang.String value)
-
merge
public static SortDirective merge(SortDirective sort, DFField field, boolean ascending)
-
removeFields
public static SortDirective removeFields(SortDirective sort, java.lang.Iterable<? extends DFField> fields)
Removesfields
fromSortDirective
. The newSortDirective
is identical withsort
, but its items no longer contain those forfields
.- Parameters:
sort
- TheSortDirective
to remove fields from.fields
- The field to remove.- Returns:
- A new
SortDirective
instance identical tosort
, but with its items filtered byfields
parameter.
-
getFields
public java.util.List<DFField> getFields()
Gets allfields
used in thisSortDirective
.- Returns:
- An immutable list of
DFField
instances.
-
getSorts
public java.util.List<SortDirective.Item> getSorts()
Gets allitems
used in thisSortDirective
.- Returns:
- An immutable list of
SortDirective.Items
instances.
-
equals
public boolean equals(java.lang.Object obj)
- Overrides:
equals
in classjava.lang.Object
-
toString
public java.lang.String toString()
- Overrides:
toString
in classjava.lang.Object
-
hashCode
public int hashCode()
- Overrides:
hashCode
in classjava.lang.Object
-
-