View Javadoc
1   /*
2    * scriptable-dataset (https://github.com/hazendaz/scriptable-dataset)
3    *
4    * Copyright 2011-2023 Hazendaz.
5    *
6    * All rights reserved. This program and the accompanying materials
7    * are made available under the terms of The Apache Software License,
8    * Version 2.0 which accompanies this distribution, and is available at
9    * https://www.apache.org/licenses/LICENSE-2.0.txt
10   *
11   * Contributors:
12   *     Gunnar Morling
13   *     Hazendaz (Jeremy Landis).
14   */
15  package de.gmorling.scriptabledataset;
16  
17  import java.util.List;
18  
19  import org.dbunit.dataset.DataSetException;
20  import org.dbunit.dataset.ITable;
21  import org.dbunit.dataset.ITableIterator;
22  import org.dbunit.dataset.ITableMetaData;
23  
24  /**
25   * The Class ScriptableIterator.
26   */
27  public class ScriptableIterator implements ITableIterator {
28  
29      /** The wrapped. */
30      private ITableIterator wrapped;
31  
32      /** The configurations. */
33      private List<ScriptableDataSetConfig> configurations;
34  
35      /**
36       * Instantiates a new scriptable iterator.
37       *
38       * @param wrapped
39       *            the wrapped
40       * @param configurations
41       *            the configurations
42       */
43      public ScriptableIterator(ITableIterator wrapped, List<ScriptableDataSetConfig> configurations) {
44          this.wrapped = wrapped;
45          this.configurations = configurations;
46      }
47  
48      @Override
49      public ITable getTable() throws DataSetException {
50          return new ScriptableTable(wrapped.getTable(), configurations);
51      }
52  
53      @Override
54      public ITableMetaData getTableMetaData() throws DataSetException {
55          return wrapped.getTableMetaData();
56      }
57  
58      @Override
59      public boolean next() throws DataSetException {
60          return wrapped.next();
61      }
62  
63  }