Modifier and Type | Field and Description |
---|---|
static String |
SQL_SET_SEPARATOR |
Constructor and Description |
---|
SQLUtils() |
Modifier and Type | Method and Description |
---|---|
static String |
addLeadingKeyword(String cond,
String keyword) |
static String |
addTrailingKeyword(String cond,
String keyword) |
static String |
createIntListCond(String columnName,
List<Integer> values,
String operator) |
static <E extends Enum<E>> |
readEnumSet(ResultSet rs,
String columnLabel,
Class<E> enumClass)
Reads a value of an SQL
SET column into an EnumSet . |
static <E extends Enum<E>> |
readEnumSet(String value,
Class<E> enumClass)
Reads a value of an SQL
SET column into an EnumSet . |
public static final String SQL_SET_SEPARATOR
public SQLUtils()
public static String createIntListCond(String columnName, List<Integer> values, String operator)
public static String addLeadingKeyword(String cond, String keyword)
public static String addTrailingKeyword(String cond, String keyword)
public static <E extends Enum<E>> EnumSet<E> readEnumSet(ResultSet rs, String columnLabel, Class<E> enumClass) throws SQLException
SET
column into an EnumSet
.
Note that the names of the enumeration constants used in SQL and in Java need to be identical (case sensitive match).
If null
is read from the database the returned set will also be null
.
If an empty string (representation of an empty SET
) is read an empty set will be returned.
rs
- the result set to read the data fromcolumnLabel
- the label of the column containing the SET
valueenumClass
- the enum
class that represents the SQL SET
in Javaenum
set corresponding the value in the databaseSQLException
public static <E extends Enum<E>> EnumSet<E> readEnumSet(String value, Class<E> enumClass)
SET
column into an EnumSet
.
Note that the names of the enumeration constants used in SQL and in Java need to be identical (case sensitive match).
If null
is specified as value
the returned set will also be null
.
If an empty string is specified as value
an empty set will be returned.
value
- the string representation of the SQL SET
valueenumClass
- the enum
class that represents the SQL SET
in Javaenum
set corresponding the value in the database