Package net.sf.basedb.core
Enum ItemContext.SortDirection
- java.lang.Object
-
- java.lang.Enum<ItemContext.SortDirection>
-
- net.sf.basedb.core.ItemContext.SortDirection
-
- All Implemented Interfaces:
Serializable
,Comparable<ItemContext.SortDirection>
- Enclosing class:
- ItemContext
public static enum ItemContext.SortDirection extends Enum<ItemContext.SortDirection>
Enumeration used to specify the sort direction.
-
-
Field Summary
Fields Modifier and Type Field Description private String
displayValue
The string value of this direction.private int
value
The integer value of this direction.private static Map<Integer,ItemContext.SortDirection>
valueMapping
Maps an integer to a sort direction.
-
Constructor Summary
Constructors Modifier Constructor Description private
SortDirection(int value, String displayValue)
Creates a new direction.
-
Method Summary
All Methods Static Methods Instance Methods Abstract Methods Concrete Methods Modifier and Type Method Description static ItemContext.SortDirection
fromValue(int value)
Get theSortDirection
object when you know the integer code.abstract ItemContext.SortDirection
getReverseDirection()
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)
.String
toString()
static ItemContext.SortDirection
valueOf(String name)
Returns the enum constant of this type with the specified name.static ItemContext.SortDirection[]
values()
Returns an array containing the constants of this enum type, in the order they are declared.
-
-
-
Enum Constant Detail
-
ASC
public static final ItemContext.SortDirection ASC
Items are sorted in ascending order.
-
DESC
public static final ItemContext.SortDirection DESC
Items are sorted in descending order.
-
-
Field Detail
-
valueMapping
private static final Map<Integer,ItemContext.SortDirection> valueMapping
Maps an integer to a sort direction.
-
value
private final int value
The integer value of this direction.
-
displayValue
private final String displayValue
The string value of this direction.
-
-
Constructor Detail
-
SortDirection
private SortDirection(int value, String displayValue)
Creates a new direction. Used internal only.- Parameters:
value
- The integer value of the directiondisplayValue
- Returned by the toString method
-
-
Method Detail
-
values
public static ItemContext.SortDirection[] values()
Returns an array containing the constants of this enum type, in the order they are declared. This method may be used to iterate over the constants as follows:for (ItemContext.SortDirection c : ItemContext.SortDirection.values()) System.out.println(c);
- Returns:
- an array containing the constants of this enum type, in the order they are declared
-
valueOf
public static ItemContext.SortDirection valueOf(String name)
Returns the enum constant of this type with the specified name. The string must match exactly an identifier used to declare an enum constant in this type. (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 type has no constant with the specified nameNullPointerException
- if the argument is null
-
fromValue
public static ItemContext.SortDirection fromValue(int value)
Get theSortDirection
object when you know the integer code.- Parameters:
value
- The integer value.- Returns:
- The location for the integer value.
-
sortBy
public abstract Order sortBy(Expression e)
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
public abstract ItemContext.SortDirection getReverseDirection()
Get the reverse sort direction.- Since:
- 3.3
-
toString
public String 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.
-
-