Package net.sf.basedb.core
Enum Class ItemContext.SortDirection
- All Implemented Interfaces:
Serializable
,Comparable<ItemContext.SortDirection>
,java.lang.constant.Constable
- Enclosing class:
- ItemContext
Enumeration used to specify the sort direction.
-
Nested Class Summary
Nested classes/interfaces inherited from class java.lang.Enum
Enum.EnumDesc<E extends Enum<E>>
-
Enum Constant Summary
Enum Constants -
Field Summary
FieldsModifier and TypeFieldDescriptionprivate final String
The string value of this direction.private final int
The integer value of this direction.private static final Map<Integer,
ItemContext.SortDirection> Maps an integer to a sort direction. -
Constructor Summary
ConstructorsModifierConstructorDescriptionprivate
SortDirection
(int value, String displayValue) Creates a new direction. -
Method Summary
Modifier and TypeMethodDescriptionstatic ItemContext.SortDirection
fromValue
(int value) Get theSortDirection
object when you know the integer code.abstract ItemContext.SortDirection
Get the reverse sort direction.int
getValue()
Get the integer value that is used when storing an location to the database.abstract Order
sortBy
(Expression e) Create an order expression that can be used with queries:Query.order(Order)
.toString()
static ItemContext.SortDirection
Returns the enum constant of this class with the specified name.static ItemContext.SortDirection[]
values()
Returns an array containing the constants of this enum class, in the order they are declared.
-
Enum Constant Details
-
ASC
Items are sorted in ascending order. -
DESC
Items are sorted in descending order.
-
-
Field Details
-
valueMapping
Maps an integer to a sort direction. -
value
private final int valueThe integer value of this direction. -
displayValue
The string value of this direction.
-
-
Constructor Details
-
SortDirection
Creates a new direction. Used internal only.- Parameters:
value
- The integer value of the directiondisplayValue
- Returned by the toString method
-
-
Method Details
-
values
Returns an array containing the constants of this enum class, in the order they are declared.- Returns:
- an array containing the constants of this enum class, in the order they are declared
-
valueOf
Returns the enum constant of this class with the specified name. The string must match exactly an identifier used to declare an enum constant in this class. (Extraneous whitespace characters are not permitted.)- Parameters:
name
- the name of the enum constant to be returned.- Returns:
- the enum constant with the specified name
- Throws:
IllegalArgumentException
- if this enum class has no constant with the specified nameNullPointerException
- if the argument is null
-
fromValue
Get theSortDirection
object when you know the integer code.- Parameters:
value
- The integer value.- Returns:
- The location for the integer value.
-
sortBy
Create an order expression that can be used with queries:Query.order(Order)
.- Parameters:
e
- The expression to sort by- Returns:
- An order object
- Since:
- 2.13
-
getReverseDirection
Get the reverse sort direction.- Since:
- 3.3
-
toString
- Overrides:
toString
in classEnum<ItemContext.SortDirection>
-
getValue
public int getValue()Get the integer value that is used when storing an location to the database.- Returns:
- The integer value for this location.
-