Class Row
java.lang.Object
uk.ac.manchester.spinnaker.alloc.db.Row
public final class Row extends Object
A restricted form of result set. Note that this object must not be
saved outside the context of iteration over its' query's results.
- Author:
- Donal Fellows
-
Method Summary
Modifier and Type Method Description static DatabaseAPI.RowMapper<Boolean>
bool(String columnLabel)
Get a function to get the contents of the named column.static DatabaseAPI.RowMapper<byte[]>
bytes(String columnLabel)
Get a function to get the contents of the named column.static DatabaseAPI.RowMapper<ChipLocation>
chip(String x, String y)
Create a function for extracting a chip from a result set row.static DatabaseAPI.RowMapper<CoreLocation>
core(String x, String y, String p)
Create a function for extracting a core from a result set row.static DatabaseAPI.RowMapper<Duration>
duration(String columnLabel)
Get a function to get the contents of the named column.static <T extends Enum<T>>
DatabaseAPI.RowMapper<T>enumerate(String columnLabel, Class<T> type)
Get a function to get the contents of the named column.boolean
getBoolean(String columnLabel)
Get the contents of the named column.byte[]
getBytes(String columnLabel)
Get the contents of the named column.ChipLocation
getChip(String x, String y)
Get a chip from a result set row.Set<String>
getColumnNames()
Get the column names from this row.CoreLocation
getCore(String x, String y, String p)
Get a core from a result set row.Duration
getDuration(String columnLabel)
Get the contents of the named column.<T extends Enum<T>>
TgetEnum(String columnLabel, Class<T> type)
Get the contents of the named column.Instant
getInstant(String columnLabel)
Get the contents of the named column.int
getInt(String columnLabel)
Get the contents of the named column.Integer
getInteger(String columnLabel)
Get the contents of the named column.Long
getLong(String columnLabel)
Get the contents of the named column.Object
getObject(String columnLabel)
Get the contents of the named column.<T> T
getSerial(String columnLabel, Class<T> cls)
Get the contents of the named column by deserialization.String
getString(String columnLabel)
Get the contents of the named column.static DatabaseAPI.RowMapper<Instant>
instant(String columnLabel)
Get a function to get the contents of the named column.static ToIntFunction<Row>
int32(String columnLabel)
Get a function to get the contents of the named column.static DatabaseAPI.RowMapper<Long>
int64(String columnLabel)
Get a function to get the contents of the named column.static DatabaseAPI.RowMapper<Integer>
integer(String columnLabel)
Get a function to get the contents of the named column.static DatabaseAPI.RowMapper<Object>
object(String columnLabel)
Get a function to get the contents of the named column.static <T> DatabaseAPI.RowMapper<T>
serial(String columnLabel, Class<T> cls)
Get a function to get the contents of the named column.static <T> MappableIterable<T>
stream(List<T> lst)
Make a mappable iterator out of a list.static DatabaseAPI.RowMapper<String>
string(String columnLabel)
Get a function to get the contents of the named column.String
toString()
-
Method Details
-
getColumnNames
Get the column names from this row.- Returns:
- The set of column names; all lookup of columns is by name, so the order is unimportant. (The set returned will iterate over the names in the order they are in the underlying result set, but this is considered "unimportant".)
- Throws:
DataAccessException
- If the column names can't be retrieved.
-
getString
Get the contents of the named column.- Parameters:
columnLabel
- The name of the column.- Returns:
- A string, or
null
onNULL
. - Throws:
DataAccessException
- If the column's contents can't be retrieved.
-
string
Get a function to get the contents of the named column.- Parameters:
columnLabel
- The name of the column.- Returns:
- A function to get the string from the column of a row.
-
getBoolean
Get the contents of the named column.- Parameters:
columnLabel
- The name of the column.- Returns:
- A boolean, or
false
onNULL
. - Throws:
DataAccessException
- If the column's contents can't be retrieved.
-
bool
Get a function to get the contents of the named column.- Parameters:
columnLabel
- The name of the column.- Returns:
- A function to get the
boolean
from the column of a row.
-
getInt
Get the contents of the named column.- Parameters:
columnLabel
- The name of the column.- Returns:
- An integer, or
0
onNULL
. - Throws:
DataAccessException
- If the column's contents can't be retrieved.
-
int32
Get a function to get the contents of the named column.- Parameters:
columnLabel
- The name of the column.- Returns:
- A function to get the
int
from the column of a row.
-
getInteger
Get the contents of the named column.- Parameters:
columnLabel
- The name of the column.- Returns:
- An integer or
null
. - Throws:
DataAccessException
- If the column's contents can't be retrieved.
-
integer
Get a function to get the contents of the named column.- Parameters:
columnLabel
- The name of the column.- Returns:
- A function to get the nullable integer from the column of a row.
-
getBytes
Get the contents of the named column.- Parameters:
columnLabel
- The name of the column.- Returns:
- A byte array, or
null
onNULL
. - Throws:
DataAccessException
- If the column's contents can't be retrieved.
-
bytes
Get a function to get the contents of the named column.- Parameters:
columnLabel
- The name of the column.- Returns:
- A function to get the byte array from the column of a row.
-
getSerial
Get the contents of the named column by deserialization.- Type Parameters:
T
- The type of value expected.- Parameters:
columnLabel
- The name of the column.cls
- The type of value expected.- Returns:
- A deserialized object, or
null
onNULL
. - Throws:
DataAccessException
- If the column's contents can't be retrieved.TypeMismatchDataAccessException
- If the object is not of the required type.
-
serial
Get a function to get the contents of the named column.- Type Parameters:
T
- The type of value expected.- Parameters:
columnLabel
- The name of the column.cls
- The type of value expected.- Returns:
- A function to get the deserialized object from the column of a row.
-
getInstant
Get the contents of the named column.- Parameters:
columnLabel
- The name of the column.- Returns:
- An instant, or
null
onNULL
. - Throws:
DataAccessException
- If the column's contents can't be retrieved.
-
instant
Get a function to get the contents of the named column.- Parameters:
columnLabel
- The name of the column.- Returns:
- A function to get the instant from the column of a row.
-
getDuration
Get the contents of the named column.- Parameters:
columnLabel
- The name of the column.- Returns:
- A duration, or
null
onNULL
. - Throws:
DataAccessException
- If the column's contents can't be retrieved.
-
duration
Get a function to get the contents of the named column.- Parameters:
columnLabel
- The name of the column.- Returns:
- A function to get the duration from the column of a row.
-
getObject
Get the contents of the named column.- Parameters:
columnLabel
- The name of the column.- Returns:
- An automatically-decoded object, or
null
onNULL
. (Only returns basic types due to the way SQLite type affinities work;Integer
,Double
,String
, orbyte[]
.) - Throws:
DataAccessException
- If the column's contents can't be retrieved.
-
object
Get a function to get the contents of the named column.- Parameters:
columnLabel
- The name of the column.- Returns:
- A function to get the object from the column of a row.
-
getEnum
Get the contents of the named column.- Type Parameters:
T
- The enumeration type.- Parameters:
columnLabel
- The name of the column.type
- The enumeration type class.- Returns:
- An enum value, or
null
onNULL
. - Throws:
DataAccessException
- If the column's contents can't be retrieved.
-
enumerate
public static <T extends Enum<T>> DatabaseAPI.RowMapper<T> enumerate(String columnLabel, Class<T> type)Get a function to get the contents of the named column.- Type Parameters:
T
- The enumeration type.- Parameters:
columnLabel
- The name of the column.type
- The enumeration type class.- Returns:
- A function to get the
enum
from the column of a row.
-
getLong
Get the contents of the named column.- Parameters:
columnLabel
- The name of the column.- Returns:
- A long value, or
null
onNULL
. - Throws:
DataAccessException
- If the column's contents can't be retrieved.
-
int64
Get a function to get the contents of the named column.- Parameters:
columnLabel
- The name of the column.- Returns:
- A function to get the nullable
long
from the column of a row.
-
toString
-
getChip
Get a chip from a result set row.- Parameters:
x
- The name of the column with the X coordinate.y
- The name of the column with the Y coordinate.- Returns:
- The chip location.
-
chip
Create a function for extracting a chip from a result set row.- Parameters:
x
- The name of the column with the X coordinate.y
- The name of the column with the Y coordinate.- Returns:
- The mapping function.
-
getCore
Get a core from a result set row.- Parameters:
x
- The name of the column with the X coordinate.y
- The name of the column with the Y coordinate.p
- The name of the column with the core ID.- Returns:
- The core location.
-
core
Create a function for extracting a core from a result set row.- Parameters:
x
- The name of the column with the X coordinate.y
- The name of the column with the Y coordinate.p
- The name of the column with the core ID.- Returns:
- The mapping function.
-
stream
Make a mappable iterator out of a list.- Type Parameters:
T
- The type of the list.- Parameters:
lst
- The list to convert.- Returns:
- A mappable iterator.
-