Package com.illumon.iris.db.v2
Class SortedColumnsAttribute
java.lang.Object
com.illumon.iris.db.v2.SortedColumnsAttribute
public class SortedColumnsAttribute extends Object
Helper class for managing the sorted columns attribute.
-
Method Summary
Modifier and Type Method Description static Optional<SortingOrder>
getOrderForColumn(Table table, String columnName)
Retrieve the sorting order for a column from a table.static Optional<SortingOrder>
getOrderForColumn(String attribute, String columnName)
Retrieve the sorting order for a column from an attribute.static boolean
isSortedBy(Table table, String columnName, SortingOrder order)
Determine if a table is sorted by the given column and order.static void
setOrderForColumn(Table table, String columnName, SortingOrder order)
Mark the table as sorted by the given column.static String
setOrderForColumn(String attribute, String columnName, SortingOrder order)
Pack the desired sorting order into a String attribute.
-
Method Details
-
getOrderForColumn
Retrieve the sorting order for a column from an attribute.- Parameters:
attribute
- the Table's value ofTable.SORTED_COLUMNS_ATTRIBUTE
.columnName
- the name of the column- Returns:
- an optional containing the SortingOrder of the column if defined, empty otherwise
-
getOrderForColumn
Retrieve the sorting order for a column from a table.- Parameters:
table
- the table to interrogatecolumnName
- the name of the column- Returns:
- an optional containing the SortingOrder of the column if defined, empty otherwise
-
isSortedBy
Determine if a table is sorted by the given column and order.- Parameters:
table
- the table to interrogatecolumnName
- the name of the columnorder
- the order to check for- Returns:
- true if table is sorted by columnName in the specified order
-
setOrderForColumn
Pack the desired sorting order into a String attribute.- Parameters:
attribute
- an attribute containing sorting ordercolumnName
- the column to updateorder
- the order that the column is sorted in- Returns:
- a String suitable for use as a
Table.SORTED_COLUMNS_ATTRIBUTE
value.
-
setOrderForColumn
Mark the table as sorted by the given column.- Parameters:
table
- the table to updatecolumnName
- the column to updateorder
- the order that the column is sorted in
-