Package org.springframework.data.domain
Enum Class Sort.Direction
- All Implemented Interfaces:
Serializable
,Comparable<Sort.Direction>
,Constable
- Enclosing class:
- Sort
Enumeration for sort directions.
- Author:
- Oliver Gierke
-
Nested Class Summary
Nested classes/interfaces inherited from class java.lang.Enum
Enum.EnumDesc<E extends Enum<E>>
-
Enum Constant Summary
-
Method Summary
Modifier and TypeMethodDescriptionstatic Optional<Sort.Direction>
fromOptionalString
(String value) Returns theSort.Direction
enum for the givenString
orOptional.empty()
if it cannot be parsed into an enum value.static Sort.Direction
fromString
(String value) Returns theSort.Direction
enum for the givenString
value.boolean
Returns whether the direction is ascending.boolean
Returns whether the direction is descending.static Sort.Direction
Returns the enum constant of this class with the specified name.static Sort.Direction[]
values()
Returns an array containing the constants of this enum class, in the order they are declared.
-
Enum Constant Details
-
ASC
-
DESC
-
-
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
-
isAscending
public boolean isAscending()Returns whether the direction is ascending.- Returns:
- true if ascending, false otherwise.
- Since:
- 1.13
-
isDescending
public boolean isDescending()Returns whether the direction is descending.- Returns:
- true if descending, false otherwise.
- Since:
- 1.13
-
fromString
Returns theSort.Direction
enum for the givenString
value.- Parameters:
value
- the direction name.- Returns:
- the
Sort.Direction
enum value for the givenvalue
. - Throws:
IllegalArgumentException
- in case the given value cannot be parsed into an enum value.
-
fromOptionalString
Returns theSort.Direction
enum for the givenString
orOptional.empty()
if it cannot be parsed into an enum value.- Parameters:
value
- the direction name.- Returns:
- Optional holding the
Sort.Direction
enum value or empty, ifvalue
cannot be parsed intoSort.Direction
.
-