DataBridge Documentation 2.0.17
A Java library for managing database connections and transactions
|
Static Public Member Functions | |
static< T > List< T > | load (ResultSet resultSet, Class< T > clazz) |
The Adapter
class provides a utility method for mapping a ResultSet
to a list of objects of a specified class type.
This class leverages reflection to map columns in the ResultSet
to the fields of the provided class. It supports field names in both camelCase and snake_case.
The load
method reads rows from a ResultSet
and maps each row to an instance of the provided class. If any issues are encountered during mapping, they are logged using the SQLogger
.
The toSnakeCase
method is used to convert camelCase field names to snake_case column names, following typical database conventions.
|
static |
Maps a ResultSet
to a List
of objects of the specified class type.
This method iterates over the rows of the ResultSet
, creating an instance of the provided class for each row. It uses reflection to match the column names from the ResultSet
to the fields of the class.
<T> | The type of the object to map to. |
resultSet | The ResultSet to map. |
clazz | The class type to map the ResultSet to. |
List
of objects of the specified class type, populated with data from the ResultSet
.