01: package com.mockrunner.jdbc;
02:
03: import java.util.ArrayList;
04: import java.util.Collections;
05: import java.util.List;
06:
07: import com.mockrunner.mock.jdbc.MockStatement;
08:
09: /**
10: * Concrete handler for {@link AbstractResultSetHandler}.
11: */
12: public class StatementResultSetHandler extends AbstractResultSetHandler {
13: private List statements;
14:
15: public StatementResultSetHandler() {
16: statements = new ArrayList();
17: }
18:
19: /**
20: * The <code>Connection</code> adds new statements with
21: * this method.
22: * @param statement the {@link MockStatement}
23: */
24: public void addStatement(MockStatement statement) {
25: statement.setResultSetHandler(this );
26: statements.add(statement);
27: }
28:
29: /**
30: * Returns a <code>List</code> of all statements.
31: * @return the <code>List</code> of {@link MockStatement} objects
32: */
33: public List getStatements() {
34: return Collections.unmodifiableList(statements);
35: }
36:
37: /**
38: * Clears the <code>List</code> of statements.
39: */
40: public void clearStatements() {
41: statements.clear();
42: }
43: }
|