Class OrderImpl
java.lang.Object
de.digitalcollections.model.impl.paging.OrderImpl
- All Implemented Interfaces:
Order
public class OrderImpl extends java.lang.Object implements Order
-
Nested Class Summary
Nested classes/interfaces inherited from interface de.digitalcollections.model.api.paging.Order
Order.Builder -
Constructor Summary
Constructors Constructor Description OrderImpl()OrderImpl(Direction direction, boolean ignoreCase, NullHandling nullHandling, java.lang.String property)OrderImpl(Direction direction, java.lang.String property)Creates a newOrderinstance. if order is null then order defaults toSorting.DEFAULT_DIRECTIONOrderImpl(Direction direction, java.lang.String property, NullHandling nullHandlingHint)Creates a newOrderinstance. if order is null then order defaults toSorting.DEFAULT_DIRECTIONOrderImpl(java.lang.String property)Creates a newOrderinstance. -
Method Summary
Modifier and Type Method Description booleanequals(java.lang.Object obj)DirectiongetDirection()Returns the order the property shall be sorted for.NullHandlinggetNullHandling()Returns the usedNullHandlinghint, which can but may not be respected by the used datastore.java.lang.StringgetProperty()Returns the property to order for.java.util.Optional<java.lang.String>getSubProperty()Returns the optional sub property to order for.inthashCode()OrderignoreCase()Returns a newOrderwith case insensitive sorting enabled.booleanisAscending()Returns whether sorting for this property shall be ascending.booleanisDescending()Returns whether sorting for this property shall be descending.booleanisIgnoreCase()Returns whether or not the sort will be case sensitive.OrdernullsFirst()Returns aOrderwithNullHandling.NULLS_FIRSTas null handling hint.OrdernullsLast()Returns aOrderwithNullHandling.NULLS_LASTas null handling hint.OrdernullsNative()Returns aOrderwithNullHandling.NATIVEas null handling hint.voidsetDirection(Direction direction)voidsetIgnoreCase(boolean ignoreCase)voidsetNullHandling(NullHandling nullHandling)voidsetProperty(java.lang.String property)voidsetSubProperty(java.lang.String property)java.lang.StringtoString()Orderwith(Direction direction)Orderwith(NullHandling nullHandling)Returns aOrderwith the givenNullHandling.SortingwithProperties(java.lang.String... properties)Returns a newSortinginstance for the given properties.OrderwithProperty(java.lang.String property)Returns a newOrderMethods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
-
Constructor Details
-
OrderImpl
public OrderImpl() -
OrderImpl
public OrderImpl(Direction direction, boolean ignoreCase, NullHandling nullHandling, java.lang.String property) -
OrderImpl
Creates a newOrderinstance. if order is null then order defaults toSorting.DEFAULT_DIRECTION- Parameters:
direction- can be null, will default toSorting.DEFAULT_DIRECTIONproperty- must not be null or empty.
-
OrderImpl
Creates a newOrderinstance. if order is null then order defaults toSorting.DEFAULT_DIRECTION- Parameters:
direction- can be null, will default toSorting.DEFAULT_DIRECTIONproperty- must not be null or empty.nullHandlingHint- can be null, will default toNullHandling.NATIVE.
-
OrderImpl
public OrderImpl(java.lang.String property)Creates a newOrderinstance. Takes a single property. Direction defaults toSorting.DEFAULT_DIRECTION.- Parameters:
property- must not be null or empty.
-
-
Method Details
-
setDirection
-
setIgnoreCase
public void setIgnoreCase(boolean ignoreCase) -
setNullHandling
-
setProperty
public void setProperty(java.lang.String property) -
setSubProperty
public void setSubProperty(java.lang.String property) -
equals
public boolean equals(java.lang.Object obj)- Overrides:
equalsin classjava.lang.Object
-
getDirection
Returns the order the property shall be sorted for.- Specified by:
getDirectionin interfaceOrder- Returns:
- the order the property shall be sorted for
-
getNullHandling
Returns the usedNullHandlinghint, which can but may not be respected by the used datastore.- Specified by:
getNullHandlingin interfaceOrder- Returns:
- the used NullHandling hint, which can but may not be respected by the used datastore.
-
getProperty
public java.lang.String getProperty()Returns the property to order for.- Specified by:
getPropertyin interfaceOrder- Returns:
- the property to order for
-
getSubProperty
public java.util.Optional<java.lang.String> getSubProperty()Description copied from interface:OrderReturns the optional sub property to order for.A sub property is always related to the main property.
- Specified by:
getSubPropertyin interfaceOrder- Returns:
- the optional sub property to order for
-
hashCode
public int hashCode()- Overrides:
hashCodein classjava.lang.Object
-
ignoreCase
Returns a newOrderwith case insensitive sorting enabled.- Specified by:
ignoreCasein interfaceOrder- Returns:
- a new Order with case insensitive sorting enabled
-
isAscending
public boolean isAscending()Returns whether sorting for this property shall be ascending.- Specified by:
isAscendingin interfaceOrder- Returns:
- whether sorting for this property shall be ascending
-
isDescending
public boolean isDescending()Returns whether sorting for this property shall be descending.- Specified by:
isDescendingin interfaceOrder- Returns:
- whether sorting for this property shall be descending
-
isIgnoreCase
public boolean isIgnoreCase()Returns whether or not the sort will be case sensitive.- Specified by:
isIgnoreCasein interfaceOrder- Returns:
- whether or not the sort will be case sensitive
-
nullsFirst
Returns aOrderwithNullHandling.NULLS_FIRSTas null handling hint.- Specified by:
nullsFirstin interfaceOrder- Returns:
- an Order with NullHandling#NULLS_FIRST as null handling hint
-
nullsLast
Returns aOrderwithNullHandling.NULLS_LASTas null handling hint. -
nullsNative
Returns aOrderwithNullHandling.NATIVEas null handling hint.- Specified by:
nullsNativein interfaceOrder- Returns:
- an Order with NullHandling#NATIVE as null handling hint.
-
toString
public java.lang.String toString()- Overrides:
toStringin classjava.lang.Object
-
with
-
with
Returns aOrderwith the givenNullHandling. -
withProperties
Returns a newSortinginstance for the given properties.- Specified by:
withPropertiesin interfaceOrder- Parameters:
properties- given properties- Returns:
- a new SortingImpl for the given properties
-
withProperty
Returns a newOrder- Specified by:
withPropertyin interfaceOrder- Parameters:
property- must not be null or empty.- Returns:
- a new Order
-