クラス DefaultResultSetConverter
- java.lang.Object
-
- org.nkjmlab.sorm4j.extension.impl.DefaultResultSetConverter
-
- すべての実装されたインタフェース:
ResultSetConverter
public class DefaultResultSetConverter extends Object implements ResultSetConverter
Default implementation ofResultSetConverter- 作成者:
- nkjm
-
-
フィールドの概要
フィールド 修飾子とタイプ フィールド 説明 static StringCANONICALstatic StringLETTER_CASE_OF_KEY_IN_MAP_RESULTDefines the letter case of the keys in the result oftoSingleMap(org.nkjmlab.sorm4j.extension.SormOptions, java.sql.ResultSet, java.util.List<java.lang.String>, java.util.List<java.lang.Integer>).static StringLOWER_CASEstatic StringNO_CONVERSIONstatic StringUPPER_CASE
-
コンストラクタの概要
コンストラクタ コンストラクタ 説明 DefaultResultSetConverter()DefaultResultSetConverter(List<ColumnValueConverter> converters)DefaultResultSetConverter(ColumnValueConverter... converters)
-
メソッドの概要
すべてのメソッド インスタンス・メソッド concreteメソッド 修飾子とタイプ メソッド 説明 ObjectconvertColumnValueTo(SormOptions options, ResultSet resultSet, int column, int columnType, Class<?> toType)StringconvertKey(String key)protected ObjectgetColumnValueBySqlType(ResultSet resultSet, int column, int sqlType)booleanisStandardClass(SormOptions options, Class<?> objectClass)Returns the given type is enable to convert element object.Map<String,Object>toSingleMap(SormOptions options, ResultSet resultSet, List<String> columns, List<Integer> columnTypes)Converts the result from database to a map objects.<T> TtoSingleStandardObject(SormOptions options, ResultSet resultSet, int sqlType, Class<T> objectClass)Converts to a single native object of the given object class.
-
-
-
フィールドの詳細
-
LETTER_CASE_OF_KEY_IN_MAP_RESULT
public static String LETTER_CASE_OF_KEY_IN_MAP_RESULT
Defines the letter case of the keys in the result oftoSingleMap(org.nkjmlab.sorm4j.extension.SormOptions, java.sql.ResultSet, java.util.List<java.lang.String>, java.util.List<java.lang.Integer>).
-
-
コンストラクタの詳細
-
DefaultResultSetConverter
public DefaultResultSetConverter()
-
DefaultResultSetConverter
public DefaultResultSetConverter(List<ColumnValueConverter> converters)
-
DefaultResultSetConverter
public DefaultResultSetConverter(ColumnValueConverter... converters)
-
-
メソッドの詳細
-
isStandardClass
public boolean isStandardClass(SormOptions options, Class<?> objectClass)
Returns the given type is enable to convert element object. Following classes and Array are regarded as native class. boolean.class, Boolean.class, byte.class, Byte.class, short.class, Short.class, int.class, Integer.class, long.class, Long.class, float.class, Float.class, double.class, Double.class, char.class, Character.class, byte[].class, Byte[].class, char[].class, Character[].class, String.class, BigDecimal.class, java.sql.Clob.class, java.sql.Blob.class, java.sql.Date.class, java.sql.Time.class, java.sql.Timestamp.class, java.time.LocalDate.class, java.time.LocalTime.class, java.time.LocalDateTime.class, java.time.OffsetTime.class, java.time.OffsetDateTime.class, java.util.Date.class, java.util.UUID.class, java.io.InputStream.class, java.io.Reader.class, java.net.URL.class, java.net.Inet4Address.class, java.net.Inet6Address.class, Object.class- 定義:
isStandardClassインタフェース内ResultSetConverter- 戻り値:
-
toSingleMap
public Map<String,Object> toSingleMap(SormOptions options, ResultSet resultSet, List<String> columns, List<Integer> columnTypes) throws SQLException
Converts the result from database to a map objects. The data of the column is extracted by corresponding column types. Keys in the results are the names of the columns returned in lower case.- 定義:
toSingleMapインタフェース内ResultSetConvertercolumnTypes- SQL types fromTypes- 戻り値:
- 例外:
SQLException
-
toSingleStandardObject
public <T> T toSingleStandardObject(SormOptions options, ResultSet resultSet, int sqlType, Class<T> objectClass) throws SQLException
インタフェースからコピーされた説明:ResultSetConverterConverts to a single native object of the given object class.- 定義:
toSingleStandardObjectインタフェース内ResultSetConverter- 戻り値:
- 例外:
SQLException
-
convertColumnValueTo
public Object convertColumnValueTo(SormOptions options, ResultSet resultSet, int column, int columnType, Class<?> toType) throws SQLException
インタフェースからコピーされた説明:ResultSetConverterReads a column from the current row in the providedResultSetand returns an instance of the specified JavaClasscontaining the values read. This method is mainly used for "SEARCH SQL AND READ TO POJO". i.e. Convert from Sql to Java by the specified class. This method is used while convertingResultSetrows to objects. The class type is the field type in the target bean. null's will be respected for any non-native types. This means that if a field is of type Integer it will be able to receive a null value from the ResultSet; on the other hand, if a field is of type int it will receive 0 for a null value from theResultSet.- 定義:
convertColumnValueToインタフェース内ResultSetConverterresultSet-ResultSet(positioned in the row to be processed)column- column index in the result set (starting with 1)toType-Classof the object to be returned- 例外:
SQLException
-
getColumnValueBySqlType
protected Object getColumnValueBySqlType(ResultSet resultSet, int column, int sqlType) throws SQLException
Reads a column from the current row in the providedResultSetand returns an instance of the specified JavaSQLTypecontaining the values read. This method is mainly used for "SEARCH SQL AND READ TO MAP". i.e. Convert from SQL to Java by the SQL type. This method is used while convertingResultSetrows to Map.- パラメータ:
resultSet-column-sqlType-- 戻り値:
- 例外:
SQLException
-
-