public class SQLUtils extends java.lang.Object
Modifier and Type | Field and Description |
---|---|
static java.lang.String |
SQL_SET_SEPARATOR |
Constructor and Description |
---|
SQLUtils() |
Modifier and Type | Method and Description |
---|---|
static java.lang.String |
addLeadingKeyword(java.lang.String cond,
java.lang.String keyword) |
static java.lang.String |
addTrailingKeyword(java.lang.String cond,
java.lang.String keyword) |
static java.lang.String |
createIntListCond(java.lang.String columnName,
java.util.List<java.lang.Integer> values,
java.lang.String operator) |
static <E extends java.lang.Enum<E>> |
readEnumSet(java.sql.ResultSet rs,
java.lang.String columnLabel,
java.lang.Class<E> enumClass)
Reads a value of an SQL
SET column into an EnumSet . |
static <E extends java.lang.Enum<E>> |
readEnumSet(java.lang.String value,
java.lang.Class<E> enumClass)
Reads a value of an SQL
SET column into an EnumSet . |
public static final java.lang.String SQL_SET_SEPARATOR
public SQLUtils()
public static java.lang.String createIntListCond(java.lang.String columnName, java.util.List<java.lang.Integer> values, java.lang.String operator)
public static java.lang.String addLeadingKeyword(java.lang.String cond, java.lang.String keyword)
public static java.lang.String addTrailingKeyword(java.lang.String cond, java.lang.String keyword)
public static <E extends java.lang.Enum<E>> java.util.EnumSet<E> readEnumSet(java.sql.ResultSet rs, java.lang.String columnLabel, java.lang.Class<E> enumClass) throws java.sql.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 databasejava.sql.SQLException
public static <E extends java.lang.Enum<E>> java.util.EnumSet<E> readEnumSet(java.lang.String value, java.lang.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