Package org.dbunit.database
Class InMemoryMetadataResultSet
java.lang.Object
org.dbunit.database.InMemoryMetadataResultSet
- All Implemented Interfaces:
InvocationHandler
An in-memory
ResultSet, backed by rows copied out of one or more source result sets
ahead of time. It supports only the handful of ResultSet/ResultSetMetaData
methods dbunit itself calls against an IMetadataHandler result - next(),
getString(int/String), getInt(int/String), getMetaData()/
getColumnCount(), close(), plus equals()/hashCode()/
toString() for safe use as a log argument or map key - since implementing the rest of
ResultSet's ~150 methods would serve no caller. Any other method throws
UnsupportedOperationException.
A single instance answers both ResultSet calls and, since getMetaData()
returns the proxy itself, the ResultSetMetaData calls made against its result.
- Since:
- 3.5.0
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic interfaceTests whether a source result set's current row, as positioned by a precedingResultSet.next(), should be kept. -
Method Summary
Modifier and TypeMethodDescriptionstatic ResultSetfilter(ResultSet source, InMemoryMetadataResultSet.RowFilter filter) Copies the rows of the given result set that match the given filter, closing it as it is consumed, and returns a filteredResultSetpositioned before the first row.Answers exactly the methods documented on this class; any other method throwsUnsupportedOperationException.static ResultSetCopies every row of each given result set, closing each as it is consumed, and returns a single mergedResultSetpositioned before the first row.
-
Method Details
-
merge
Copies every row of each given result set, closing each as it is consumed, and returns a single mergedResultSetpositioned before the first row.- Parameters:
sources- The result sets to merge, in the order their rows should appear.- Returns:
- The merged result set.
- Throws:
SQLException- if a source result set cannot be read.
-
filter
public static ResultSet filter(ResultSet source, InMemoryMetadataResultSet.RowFilter filter) throws SQLException Copies the rows of the given result set that match the given filter, closing it as it is consumed, and returns a filteredResultSetpositioned before the first row.- Parameters:
source- The result set to filter.filter- The filter a row must match to be kept.- Returns:
- The filtered result set.
- Throws:
SQLException- if the source result set cannot be read.
-
invoke
Answers exactly the methods documented on this class; any other method throwsUnsupportedOperationException.- Specified by:
invokein interfaceInvocationHandler
-