001    package com.mockrunner.jdbc;
002    
003    import java.util.ArrayList;
004    import java.util.Collections;
005    import java.util.List;
006    
007    import com.mockrunner.mock.jdbc.MockStatement;
008    
009    /**
010     * Concrete handler for {@link AbstractResultSetHandler}.
011     */
012    public class StatementResultSetHandler extends AbstractResultSetHandler
013    {
014        private List statements;
015    
016        public StatementResultSetHandler()
017        {
018            statements = new ArrayList();
019        }  
020        
021        /**
022         * The <code>Connection</code> adds new statements with
023         * this method.
024         * @param statement the {@link MockStatement}
025         */
026        public void addStatement(MockStatement statement)
027        {
028            statement.setResultSetHandler(this);
029            statements.add(statement);
030        }
031        
032        /**
033         * Returns a <code>List</code> of all statements.
034         * @return the <code>List</code> of {@link MockStatement} objects
035         */
036        public List getStatements()
037        {
038            return Collections.unmodifiableList(statements);
039        }
040    
041        /**
042         * Clears the <code>List</code> of statements.
043         */
044        public void clearStatements()
045        {
046            statements.clear();
047        }
048    }