|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Object | +--com.fdsapi.ResultSetUtils
Provides various methods for manipulating ResultSets such as converting them to Lists, and 2 dimensional arrays.
| Constructor Summary | |
protected |
ResultSetUtils()
|
| Method Summary | |
java.lang.String[] |
convert(java.lang.Object[] arr)
Calls toString() on all elements of an Object[] array and converts all elements to a String[] array. |
java.lang.String[][] |
convert(java.lang.Object[][] arr)
Calls toString() on all elements of an Object[][] array and converts all elements to a String[][] array. |
static ResultSetUtils |
createInstance()
|
java.lang.String[] |
getColumnNames(java.sql.ResultSetMetaData resultSetMetaData)
The following method returns an array of strings containing the column names for a given ResultSetMetaData object. |
java.lang.String[] |
getColumnNames(java.sql.ResultSetMetaData resultSetMetaData,
int[] returnCols)
The following method returns an array of strings containing the column names for a given ResultSetMetaData object. |
java.lang.Object[][] |
listToObjectArray(java.util.List list)
The following method converts an List, into a two dimensional string array. |
static void |
main(java.lang.String[] args)
|
void |
objectArrayToList(java.util.List list,
java.lang.Object[][] data)
The following method converts an Object[][] to a List where each entry in the list is a row (i.e. |
void |
objectArrayToMap(java.util.Map map,
java.lang.Object[][] data)
The following method converts an Object[][] to a Map of object keys and values using an instance of Map. |
void |
resultSetMetaDataToList(java.util.List list,
java.sql.ResultSet resultSet)
The following method returns a List containing the ResultSetMetaData column names. |
void |
resultSetToList(java.util.List list,
java.sql.ResultSet resultSet)
The following method returns a List containing the ResultSet data. |
void |
resultSetToMap(java.util.Map map,
java.sql.ResultSet resultSet)
The following method converts ResultSet data to a Map of object keys and values using an instance of HashMap. |
java.lang.Object[][] |
resultSetToObjectArray(java.sql.ResultSet resultSet)
The following method simply takes the ResultSet and converts it to a two dimensional array of Objects containing data. |
| Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Constructor Detail |
protected ResultSetUtils()
| Method Detail |
public static ResultSetUtils createInstance()
public void resultSetToList(java.util.List list,
java.sql.ResultSet resultSet)
throws java.sql.SQLException
java.sql.SQLException
public void resultSetMetaDataToList(java.util.List list,
java.sql.ResultSet resultSet)
throws java.sql.SQLException
java.sql.SQLException
public void resultSetToMap(java.util.Map map,
java.sql.ResultSet resultSet)
throws java.sql.SQLException
The following method converts ResultSet data to a Map of object keys and values using an instance of HashMap.
The first column in the ResultSet supplies the key, the second column the value. If the ResultSet contains more than two columns then subsequent columns are ignored. If the ResultSet supplies only one column then an SQLException is thrown. The ResultSet values are converted to objects using the getRowData() method which converts a ResultSet row into an array of objects.
java.sql.SQLException
public void objectArrayToMap(java.util.Map map,
java.lang.Object[][] data)
The following method converts an Object[][] to a Map of object keys and values using an instance of Map.
The first column in the array supplies the key, the second column the value. If the array contains more than two columns then subsequent columns are ignored. If the array supplies only one column then a RuntimeException is thrown. This method may be used to convert the data in a ResultSetConverter to a map.
public void objectArrayToList(java.util.List list,
java.lang.Object[][] data)
The following method converts an Object[][] to a List where each entry in the list is a row (i.e. a one dimensional array Object[])
This list add/concatenate multiple arrays by making multiple calls while passing in the same list
public java.lang.Object[][] listToObjectArray(java.util.List list)
The following method converts an List, into a two dimensional string array. This array must be be allocated before it can be passed as an argument to the List toArray() method. The method assumes the list contains one dimensional arrays.
The first dimension is the row data.
The second dimension is the columns. The number of coluns is obtained by length of the string array in the first element of the List since:
1. The length of all arrays in the List must be the same.
public java.lang.Object[][] resultSetToObjectArray(java.sql.ResultSet resultSet)
throws java.sql.SQLException
java.sql.SQLException
public java.lang.String[] getColumnNames(java.sql.ResultSetMetaData resultSetMetaData)
throws java.sql.SQLException
java.sql.SQLException
public java.lang.String[] getColumnNames(java.sql.ResultSetMetaData resultSetMetaData,
int[] returnCols)
throws java.sql.SQLException
java.sql.SQLExceptionpublic java.lang.String[][] convert(java.lang.Object[][] arr)
public java.lang.String[] convert(java.lang.Object[] arr)
public static void main(java.lang.String[] args)
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||