Class CommonResultSetConverters
java.lang.Object
com.github.tadukoo.database.mysql.CommonResultSetConverters
Common Result Set Converters are used for common/simple conversions from a
ResultSet
to values- Since:
- Alpha v.0.1
- Version:
- Alpha v.0.3
- Author:
- Logan Ferree (Tadukoo)
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionThis will convert multiple rows of aResultSet
into a List of booleans, a single boolean for each rowstatic Boolean
Checks if any rows were returned in theResultSet
This will convert multiple rows of aResultSet
into a List of doubles, a single double for each rowThis will convert multiple rows of aResultSet
into a List of floats, a single float for each rowThis will convert multiple rows of aResultSet
into a List of integers, a single integer for each rowThis will convert multiple rows of aResultSet
into a List of longs, a single long for each rowThis will convert multiple rows of aResultSet
into a List of shorts, a single short for each rowstatic <Type> Type
simpleItem
(ResultSet resultSet, com.github.tadukoo.util.functional.function.ThrowingFunction<Integer, Type, SQLException> getter) To be used when only one row is expected, this will convert that single row into a single value using the given getterstatic <Type> List<Type>
simpleList
(ResultSet resultSet, com.github.tadukoo.util.functional.function.ThrowingFunction<Integer, Type, SQLException> getter) This will convert multiple rows of aResultSet
into a List of values, a single value for each row using the given getterstatic Boolean
singleBoolean
(ResultSet resultSet) To be used when only one row is expected, this will convert that single row into a single booleanstatic Date
singleDate
(ResultSet resultSet) To be used when only one row is expected, this will convert that single row into a singleDate
static Double
singleDouble
(ResultSet resultSet) To be used when only one row is expected, this will convert that single row into a single doublestatic Float
singleFloat
(ResultSet resultSet) To be used when only one row is expected, this will convert that single row into a single floatstatic Integer
singleInteger
(ResultSet resultSet) To be used when only one row is expected, this will convert that single row into a single integerstatic Long
singleLong
(ResultSet resultSet) To be used when only one row is expected, this will convert that single row into a single longstatic Short
singleShort
(ResultSet resultSet) To be used when only one row is expected, this will convert that single row into a single Shortstatic String
singleString
(ResultSet resultSet) To be used when only one row is expected, this will convert that single row into a single Stringstatic Time
singleTime
(ResultSet resultSet) To be used when only one row is expected, this will convert that single row into a singleTime
static Timestamp
singleTimestamp
(ResultSet resultSet) To be used when only one row is expected, this will convert that single row into a singleTimestamp
This will convert multiple rows of aResultSet
into a List of Strings, a single String for each rowtimestamps
(ResultSet resultSet) This will convert multiple rows of aResultSet
into a List ofTimestamps
, a singleTimestamp
for each row
-
Constructor Details
-
CommonResultSetConverters
private CommonResultSetConverters()Not allowed to instantiate
-
-
Method Details
-
check
Checks if any rows were returned in theResultSet
- Parameters:
resultSet
- TheResultSet
to be checked- Returns:
true
if any rows are in theResultSet
, otherwisefalse
- Throws:
SQLException
- If anything goes wrong
-
simpleItem
public static <Type> Type simpleItem(ResultSet resultSet, com.github.tadukoo.util.functional.function.ThrowingFunction<Integer, Type, throws SQLExceptionSQLException> getter) To be used when only one row is expected, this will convert that single row into a single value using the given getter- Type Parameters:
Type
- The Type of value to be returned- Parameters:
resultSet
- TheResultSet
to extract the value fromgetter
- TheThrowingFunction
to use to convert the row into a value- Returns:
- The value found from the single row
- Throws:
SQLException
- If anything goes wrong, or if more than one row is present in theResultSet
-
simpleList
public static <Type> List<Type> simpleList(ResultSet resultSet, com.github.tadukoo.util.functional.function.ThrowingFunction<Integer, Type, throws SQLExceptionSQLException> getter) This will convert multiple rows of aResultSet
into a List of values, a single value for each row using the given getter- Type Parameters:
Type
- The Type of values to be returned- Parameters:
resultSet
- TheResultSet
to extract the values fromgetter
- TheThrowingFunction
to use to convert rows into values- Returns:
- The List of values found from the rows
- Throws:
SQLException
- If anything goes wrong
-
singleBoolean
To be used when only one row is expected, this will convert that single row into a single boolean- Parameters:
resultSet
- TheResultSet
to extract the boolean from- Returns:
- The boolean found from the single row
- Throws:
SQLException
- If anything goes wrong, or if more than one row is present in theResultSet
-
booleans
This will convert multiple rows of aResultSet
into a List of booleans, a single boolean for each row- Parameters:
resultSet
- TheResultSet
to extract the booleans from- Returns:
- The List of booleans found from the rows
- Throws:
SQLException
- If anything goes wrong
-
singleInteger
To be used when only one row is expected, this will convert that single row into a single integer- Parameters:
resultSet
- TheResultSet
to extract the integer from- Returns:
- The integer found from the single row
- Throws:
SQLException
- If anything goes wrong, or if more than one row is present in theResultSet
-
integers
This will convert multiple rows of aResultSet
into a List of integers, a single integer for each row- Parameters:
resultSet
- TheResultSet
to extract the integers from- Returns:
- The List of integers found from the rows
- Throws:
SQLException
- If anything goes wrong
-
singleString
To be used when only one row is expected, this will convert that single row into a single String- Parameters:
resultSet
- TheResultSet
to extract the String from- Returns:
- The String found from the single row
- Throws:
SQLException
- If anything goes wrong, or if more than one row is present in theResultSet
-
strings
This will convert multiple rows of aResultSet
into a List of Strings, a single String for each row- Parameters:
resultSet
- TheResultSet
to extract the Strings from- Returns:
- The List of Strings found from the rows
- Throws:
SQLException
- If anything goes wrong
-
singleTime
To be used when only one row is expected, this will convert that single row into a singleTime
- Parameters:
resultSet
- TheResultSet
to extract theTime
from- Returns:
- The
Time
found from the single row - Throws:
SQLException
- If anything goes wrong, or if more than one row is present in theResultSet
-
times
- Parameters:
resultSet
- TheResultSet
to extract theTimes
from- Returns:
- The List of
Times
found from the rows - Throws:
SQLException
- If anything goes wrong
-
singleTimestamp
To be used when only one row is expected, this will convert that single row into a singleTimestamp
- Parameters:
resultSet
- TheResultSet
to extract theTimestamp
from- Returns:
- The
Timestamp
found from the single row - Throws:
SQLException
- If anything goes wrong, or if more than one row is present in theResultSet
-
timestamps
This will convert multiple rows of aResultSet
into a List ofTimestamps
, a singleTimestamp
for each row- Parameters:
resultSet
- TheResultSet
to extract theTimestamps
from- Returns:
- The List of
Timestamps
found from the rows - Throws:
SQLException
- If anything goes wrong
-
singleDate
To be used when only one row is expected, this will convert that single row into a singleDate
- Parameters:
resultSet
- TheResultSet
to extract theDate
from- Returns:
- The
Date
found from the single row - Throws:
SQLException
- If anything goes wrong, or if more than one row is present in theResultSet
-
dates
- Parameters:
resultSet
- TheResultSet
to extract theDates
from- Returns:
- The List of
Dates
found from the rows - Throws:
SQLException
- If anything goes wrong
-
singleShort
To be used when only one row is expected, this will convert that single row into a single Short- Parameters:
resultSet
- TheResultSet
to extract the Short from- Returns:
- The Short found from the single row
- Throws:
SQLException
- If anything goes wrong, or if more than one row is present in theResultSet
-
shorts
This will convert multiple rows of aResultSet
into a List of shorts, a single short for each row- Parameters:
resultSet
- TheResultSet
to extract the short from- Returns:
- The List of shorts found from the rows
- Throws:
SQLException
- If anything goes wrong
-
singleLong
To be used when only one row is expected, this will convert that single row into a single long- Parameters:
resultSet
- TheResultSet
to extract the long from- Returns:
- The long found from the single row
- Throws:
SQLException
- If anything goes wrong, or if more than one row is present in theResultSet
-
longs
This will convert multiple rows of aResultSet
into a List of longs, a single long for each row- Parameters:
resultSet
- TheResultSet
to extract the long from- Returns:
- The List of longs found from the rows
- Throws:
SQLException
- If anything goes wrong
-
singleFloat
To be used when only one row is expected, this will convert that single row into a single float- Parameters:
resultSet
- TheResultSet
to extract the float from- Returns:
- The float found from the single row
- Throws:
SQLException
- If anything goes wrong, or if more than one row is present in theResultSet
-
floats
This will convert multiple rows of aResultSet
into a List of floats, a single float for each row- Parameters:
resultSet
- TheResultSet
to extract the float from- Returns:
- The List of floats found from the rows
- Throws:
SQLException
- If anything goes wrong
-
singleDouble
To be used when only one row is expected, this will convert that single row into a single double- Parameters:
resultSet
- TheResultSet
to extract the double from- Returns:
- The double found from the single row
- Throws:
SQLException
- If anything goes wrong, or if more than one row is present in theResultSet
-
doubles
This will convert multiple rows of aResultSet
into a List of doubles, a single double for each row- Parameters:
resultSet
- TheResultSet
to extract the double from- Returns:
- The List of doubles found from the rows
- Throws:
SQLException
- If anything goes wrong
-