map)
{
@@ -221,7 +254,14 @@ protected static CellStyle findCellStyle(Workbook workbook,
return cellStyle;
}
- protected void setDateCell(Cell cell, Date value, Workbook workbook)
+ /**
+ * Sets the given cell to the given date value, stored as a number.
+ *
+ * @param cell the cell to set.
+ * @param value the date value to set.
+ * @param workbook the workbook the cell belongs to.
+ */
+ protected void setDateCell(Cell cell, Date value, Workbook workbook)
{
// double excelDateValue = HSSFDateUtil.getExcelDate(value);
// cell.setCellValue(excelDateValue);
@@ -283,6 +323,13 @@ protected void setDateCell(Cell cell, Date value, Workbook workbook)
}
+ /**
+ * Sets the given cell to the given numeric value, preserving its scale.
+ *
+ * @param cell the cell to set.
+ * @param value the numeric value to set.
+ * @param workbook the workbook the cell belongs to.
+ */
protected void setNumericCell(Cell cell, BigDecimal value, Workbook workbook)
{
if(logger.isDebugEnabled())
@@ -346,6 +393,11 @@ private static String createZeros(int count) {
return new String(zeros);
}
+ /**
+ * Creates the workbook written to by {@link #write(IDataSet, OutputStream)}.
+ *
+ * @return the new workbook.
+ */
protected Workbook createWorkbook() {
return new HSSFWorkbook();
}
diff --git a/src/main/java/org/dbunit/dataset/filter/AbstractTableFilter.java b/src/main/java/org/dbunit/dataset/filter/AbstractTableFilter.java
index 3f219b55b..7e051e9c6 100644
--- a/src/main/java/org/dbunit/dataset/filter/AbstractTableFilter.java
+++ b/src/main/java/org/dbunit/dataset/filter/AbstractTableFilter.java
@@ -53,6 +53,10 @@ public abstract class AbstractTableFilter implements ITableFilter
* Returns true if specified table is allowed by this filter.
* This legacy method, now replaced by accept, still exist for compatibily
* with older environment
+ *
+ * @param tableName the name of the table to check.
+ * @return true if specified table is allowed by this filter.
+ * @throws DataSetException if the check fails.
*/
public abstract boolean isValidName(String tableName) throws DataSetException;
diff --git a/src/main/java/org/dbunit/dataset/filter/DefaultColumnFilter.java b/src/main/java/org/dbunit/dataset/filter/DefaultColumnFilter.java
index 121b623dc..92444fc9d 100644
--- a/src/main/java/org/dbunit/dataset/filter/DefaultColumnFilter.java
+++ b/src/main/java/org/dbunit/dataset/filter/DefaultColumnFilter.java
@@ -62,6 +62,7 @@ public void includeColumn(String columnPattern)
/**
* Add specified columns to accepted column name list.
+ * @param columns the columns to accept.
*/
public void includeColumns(Column[] columns)
{
@@ -78,6 +79,7 @@ public void includeColumns(Column[] columns)
* The following wildcard characters are supported:
* '*' matches zero or more characters,
* '?' matches one character.
+ * @param columnPattern The column pattern to be refused.
*/
public void excludeColumn(String columnPattern)
{
@@ -88,6 +90,7 @@ public void excludeColumn(String columnPattern)
/**
* Add specified columns to excluded column name list.
+ * @param columns the columns to exclude.
*/
public void excludeColumns(Column[] columns)
{
@@ -102,6 +105,10 @@ public void excludeColumns(Column[] columns)
/**
* Returns a table backed by the specified table that only exposes specified
* columns.
+ * @param table the table to filter.
+ * @param columnNames the names of the columns to expose.
+ * @return the filtered table.
+ * @throws DataSetException if the filtered metadata cannot be built.
*/
public static ITable includedColumnsTable(ITable table, String[] columnNames)
throws DataSetException
@@ -121,6 +128,10 @@ public static ITable includedColumnsTable(ITable table, String[] columnNames)
/**
* Returns a table backed by the specified table that only exposes specified
* columns.
+ * @param table the table to filter.
+ * @param columns the columns to expose.
+ * @return the filtered table.
+ * @throws DataSetException if the filtered metadata cannot be built.
*/
public static ITable includedColumnsTable(ITable table, Column[] columns)
throws DataSetException
@@ -136,6 +147,10 @@ public static ITable includedColumnsTable(ITable table, Column[] columns)
/**
* Returns a table backed by the specified table but with specified
* columns excluded.
+ * @param table the table to filter.
+ * @param columnNames the names of the columns to exclude.
+ * @return the filtered table.
+ * @throws DataSetException if the filtered metadata cannot be built.
*/
public static ITable excludedColumnsTable(ITable table, String[] columnNames)
throws DataSetException
@@ -155,6 +170,10 @@ public static ITable excludedColumnsTable(ITable table, String[] columnNames)
/**
* Returns a table backed by the specified table but with specified
* columns excluded.
+ * @param table the table to filter.
+ * @param columns the columns to exclude.
+ * @return the filtered table.
+ * @throws DataSetException if the filtered metadata cannot be built.
*/
public static ITable excludedColumnsTable(ITable table, Column[] columns)
throws DataSetException
@@ -182,7 +201,6 @@ public boolean accept(String tableName, Column column)
return false;
}
-
public String toString()
{
final StringBuilder sb = new StringBuilder();
diff --git a/src/main/java/org/dbunit/dataset/filter/DefaultTableFilter.java b/src/main/java/org/dbunit/dataset/filter/DefaultTableFilter.java
index a76ce7725..b001afed9 100644
--- a/src/main/java/org/dbunit/dataset/filter/DefaultTableFilter.java
+++ b/src/main/java/org/dbunit/dataset/filter/DefaultTableFilter.java
@@ -50,6 +50,7 @@ public class DefaultTableFilter extends AbstractTableFilter implements ITableFil
* The following wildcard characters are supported:
* '*' matches zero or more characters,
* '?' matches one character.
+ * @param patternName the table name pattern to accept.
*/
public void includeTable(String patternName)
{
@@ -63,6 +64,7 @@ public void includeTable(String patternName)
* The following wildcard characters are supported:
* '*' matches zero or more characters,
* '?' matches one character.
+ * @param patternName the table name pattern to refuse.
*/
public void excludeTable(String patternName)
{
diff --git a/src/main/java/org/dbunit/dataset/filter/ExcludeTableFilter.java b/src/main/java/org/dbunit/dataset/filter/ExcludeTableFilter.java
index f780bbf1a..41ca446e8 100644
--- a/src/main/java/org/dbunit/dataset/filter/ExcludeTableFilter.java
+++ b/src/main/java/org/dbunit/dataset/filter/ExcludeTableFilter.java
@@ -55,6 +55,7 @@ public ExcludeTableFilter()
/**
* Create a new ExcludeTableFilter which prevent access to specified tables.
+ * @param tableNames the names of the tables to hide.
*/
public ExcludeTableFilter(String[] tableNames)
{
@@ -70,6 +71,7 @@ public ExcludeTableFilter(String[] tableNames)
* The following wildcard characters are supported:
* '*' matches zero or more characters,
* '?' matches one character.
+ * @param patternName the table name pattern to hide.
*/
public void excludeTable(String patternName)
{
@@ -78,6 +80,10 @@ public void excludeTable(String patternName)
_patternMatcher.addPattern(patternName);
}
+ /**
+ * Returns whether no tables have been excluded yet.
+ * @return true if no tables have been excluded yet.
+ */
public boolean isEmpty()
{
logger.debug("isEmpty() - start");
diff --git a/src/main/java/org/dbunit/dataset/filter/GeneratedColumnFilter.java b/src/main/java/org/dbunit/dataset/filter/GeneratedColumnFilter.java
index 43c7d3fec..f16c2f61e 100644
--- a/src/main/java/org/dbunit/dataset/filter/GeneratedColumnFilter.java
+++ b/src/main/java/org/dbunit/dataset/filter/GeneratedColumnFilter.java
@@ -31,6 +31,7 @@
*/
public class GeneratedColumnFilter implements IColumnFilter
{
+
@Override
public boolean accept(final String tableName, final Column column)
{
diff --git a/src/main/java/org/dbunit/dataset/filter/ITableFilter.java b/src/main/java/org/dbunit/dataset/filter/ITableFilter.java
index dead21550..b6dff6445 100644
--- a/src/main/java/org/dbunit/dataset/filter/ITableFilter.java
+++ b/src/main/java/org/dbunit/dataset/filter/ITableFilter.java
@@ -39,6 +39,8 @@ public interface ITableFilter extends ITableFilterSimple
* Returns the table names allowed by this filter from the specified dataset.
*
* @param dataSet the filtered dataset
+ * @return the table names allowed by this filter.
+ * @throws DataSetException if retrieving the table names fails.
*/
public String[] getTableNames(IDataSet dataSet) throws DataSetException;
@@ -46,6 +48,9 @@ public interface ITableFilter extends ITableFilterSimple
* Returns iterator of tables allowed by this filter from the specified dataset.
*
* @param dataSet the filtered dataset
+ * @param reversed true to iterate in reverse order.
+ * @return the iterator of tables allowed by this filter.
+ * @throws DataSetException if creating the iterator fails.
*/
public ITableIterator iterator(IDataSet dataSet, boolean reversed)
throws DataSetException;
diff --git a/src/main/java/org/dbunit/dataset/filter/ITableFilterSimple.java b/src/main/java/org/dbunit/dataset/filter/ITableFilterSimple.java
index df881f062..3acb654e3 100644
--- a/src/main/java/org/dbunit/dataset/filter/ITableFilterSimple.java
+++ b/src/main/java/org/dbunit/dataset/filter/ITableFilterSimple.java
@@ -34,6 +34,10 @@ public interface ITableFilterSimple
{
/**
* Returns true if specified table is allowed by this filter.
+ *
+ * @param tableName the name of the table to check.
+ * @return true if specified table is allowed by this filter.
+ * @throws DataSetException if the check fails.
*/
public boolean accept(String tableName) throws DataSetException;
diff --git a/src/main/java/org/dbunit/dataset/filter/IncludeTableFilter.java b/src/main/java/org/dbunit/dataset/filter/IncludeTableFilter.java
index c6fc40d0a..c8b158bfc 100644
--- a/src/main/java/org/dbunit/dataset/filter/IncludeTableFilter.java
+++ b/src/main/java/org/dbunit/dataset/filter/IncludeTableFilter.java
@@ -53,6 +53,7 @@ public IncludeTableFilter()
/**
* Create a new IncludeTableFilter which allow access to specified tables.
+ * @param tableNames the names of the tables to allow.
*/
public IncludeTableFilter(String[] tableNames)
{
@@ -68,6 +69,7 @@ public IncludeTableFilter(String[] tableNames)
* The following wildcard characters are supported:
* '*' matches zero or more characters,
* '?' matches one character.
+ * @param patternName the table name pattern to allow.
*/
public void includeTable(String patternName)
{
@@ -76,6 +78,10 @@ public void includeTable(String patternName)
_patternMatcher.addPattern(patternName);
}
+ /**
+ * Returns whether no tables have been included yet.
+ * @return true if no tables have been included yet.
+ */
public boolean isEmpty()
{
logger.debug("isEmpty() - start");
diff --git a/src/main/java/org/dbunit/dataset/filter/SequenceTableFilter.java b/src/main/java/org/dbunit/dataset/filter/SequenceTableFilter.java
index f7006f605..e61acf560 100644
--- a/src/main/java/org/dbunit/dataset/filter/SequenceTableFilter.java
+++ b/src/main/java/org/dbunit/dataset/filter/SequenceTableFilter.java
@@ -58,9 +58,10 @@ public class SequenceTableFilter implements ITableFilter
/**
* Creates a new SequenceTableFilter with specified table names sequence.
+ * @param tableNames the table names, in the sequence they should be exposed.
* @throws AmbiguousTableNameException If the given array contains ambiguous names
*/
- public SequenceTableFilter(String[] tableNames)
+ public SequenceTableFilter(String[] tableNames)
throws AmbiguousTableNameException
{
this(tableNames, false);
@@ -68,8 +69,8 @@ public SequenceTableFilter(String[] tableNames)
/**
* Creates a new SequenceTableFilter with specified table names sequence.
- * @param tableNames
- * @param caseSensitiveTableNames
+ * @param tableNames the table names, in the sequence they should be exposed.
+ * @param caseSensitiveTableNames whether table names are handled in a case sensitive way.
* @throws AmbiguousTableNameException If the given array contains ambiguous names
* @since 2.4.2
*/
diff --git a/src/main/java/org/dbunit/dataset/filter/SequenceTableIterator.java b/src/main/java/org/dbunit/dataset/filter/SequenceTableIterator.java
index c8e0c2cda..0ca9f2f79 100644
--- a/src/main/java/org/dbunit/dataset/filter/SequenceTableIterator.java
+++ b/src/main/java/org/dbunit/dataset/filter/SequenceTableIterator.java
@@ -49,6 +49,12 @@ public class SequenceTableIterator implements ITableIterator
private final IDataSet _dataSet;
private int _index = -1;
+ /**
+ * Creates an iterator that returns the given dataset's tables in the given name order.
+ *
+ * @param tableNames the table names, in the order they should be returned.
+ * @param dataSet the dataset providing the tables.
+ */
public SequenceTableIterator(String[] tableNames, IDataSet dataSet)
{
_tableNames = tableNames;
diff --git a/src/main/java/org/dbunit/dataset/sqlloader/SqlLoaderControlParser.java b/src/main/java/org/dbunit/dataset/sqlloader/SqlLoaderControlParser.java
index 60d89187c..6b6eb7481 100644
--- a/src/main/java/org/dbunit/dataset/sqlloader/SqlLoaderControlParser.java
+++ b/src/main/java/org/dbunit/dataset/sqlloader/SqlLoaderControlParser.java
@@ -40,36 +40,41 @@ public interface SqlLoaderControlParser {
/**
* Parse.
- *
+ *
* @param file the file
* @return the list
- *
- * @throws IOException
- * @throws SqlLoaderControlParserException
+ *
+ * @throws IOException if the file cannot be read.
+ * @throws SqlLoaderControlParserException if the control file is malformed.
*/
List parse(File file) throws IOException, SqlLoaderControlParserException;
/**
* Parse.
- *
+ *
* @param url the URL
* @return the list
- *
- * @throws IOException
- * @throws SqlLoaderControlParserException
+ *
+ * @throws IOException if the URL cannot be read.
+ * @throws SqlLoaderControlParserException if the control file is malformed.
*/
List parse(URL url) throws IOException, SqlLoaderControlParserException;
/**
* Parse.
- *
+ *
* @param csv the CSV data
* @return the list
- *
- * @throws IllegalInputCharacterException
- * @throws PipelineException
+ *
+ * @throws IllegalInputCharacterException if the CSV data contains an unexpected character.
+ * @throws PipelineException if the CSV data cannot be parsed.
*/
List parse(String csv) throws PipelineException, IllegalInputCharacterException;
+ /**
+ * Returns the name of the table parsed from the control file.
+ *
+ * @return the name of the table parsed from the control file.
+ */
String getTableName();
}
diff --git a/src/main/java/org/dbunit/dataset/sqlloader/SqlLoaderControlParserImpl.java b/src/main/java/org/dbunit/dataset/sqlloader/SqlLoaderControlParserImpl.java
index 5a4c2c0fd..997559072 100644
--- a/src/main/java/org/dbunit/dataset/sqlloader/SqlLoaderControlParserImpl.java
+++ b/src/main/java/org/dbunit/dataset/sqlloader/SqlLoaderControlParserImpl.java
@@ -58,6 +58,7 @@
*/
public class SqlLoaderControlParserImpl implements SqlLoaderControlParser {
+ /** The character that separates fields in the SQLLoader control file. */
public static final char SEPARATOR_CHAR = ';';
/** The pipeline. */
@@ -235,8 +236,16 @@ private File resolveFile(File parentDir, String fileName) {
return dataFile;
}
- protected String parseForRegexp(String controlFileContent, String regexp)
- throws IOException
+ /**
+ * Returns the first capture group of the given regexp matched against the given content.
+ *
+ * @param controlFileContent the content to search.
+ * @param regexp the regular expression to match, with a single capture group.
+ * @return the matched capture group, or null if the regexp does not match.
+ * @throws IOException never thrown by this implementation.
+ */
+ protected String parseForRegexp(String controlFileContent, String regexp)
+ throws IOException
{
logger.debug("parseForRegexp(controlFileContent={}, regexp={}) - start", controlFileContent, regexp);
diff --git a/src/main/java/org/dbunit/dataset/sqlloader/SqlLoaderControlProducer.java b/src/main/java/org/dbunit/dataset/sqlloader/SqlLoaderControlProducer.java
index 322f09f54..e69990a2d 100644
--- a/src/main/java/org/dbunit/dataset/sqlloader/SqlLoaderControlProducer.java
+++ b/src/main/java/org/dbunit/dataset/sqlloader/SqlLoaderControlProducer.java
@@ -81,9 +81,9 @@ public class SqlLoaderControlProducer implements IDataSetProducer {
*
* @param controlFilesDir the control files directory
* @param tableOrderFile the table order file
- * @throws DataSetException
+ * @throws DataSetException if the table order file cannot be read.
*/
- public SqlLoaderControlProducer(String controlFilesDir, String tableOrderFile)
+ public SqlLoaderControlProducer(String controlFilesDir, String tableOrderFile)
throws DataSetException
{
this(new File(controlFilesDir), new File(tableOrderFile));
@@ -94,9 +94,9 @@ public SqlLoaderControlProducer(String controlFilesDir, String tableOrderFile)
*
* @param controlFilesDir the control files directory
* @param tableOrderFile the table order file
- * @throws DataSetException
+ * @throws DataSetException if the table order file cannot be read.
*/
- public SqlLoaderControlProducer(File controlFilesDir, File tableOrderFile)
+ public SqlLoaderControlProducer(File controlFilesDir, File tableOrderFile)
throws DataSetException
{
this.controlFilesDir = controlFilesDir;
diff --git a/src/main/java/org/dbunit/dataset/stream/BufferedConsumer.java b/src/main/java/org/dbunit/dataset/stream/BufferedConsumer.java
index 40cf5ba1d..dac209e1c 100644
--- a/src/main/java/org/dbunit/dataset/stream/BufferedConsumer.java
+++ b/src/main/java/org/dbunit/dataset/stream/BufferedConsumer.java
@@ -64,9 +64,12 @@ public class BufferedConsumer implements IDataSetConsumer {
/**
+ * Creates a consumer that buffers all data until {@link #endDataSet()}, then flushes it
+ * to the given wrapped consumer.
+ *
* @param wrappedConsumer The consumer that is wrapped
*/
- public BufferedConsumer(IDataSetConsumer wrappedConsumer)
+ public BufferedConsumer(IDataSetConsumer wrappedConsumer)
{
if (wrappedConsumer == null) {
throw new NullPointerException(
diff --git a/src/main/java/org/dbunit/dataset/stream/DataSetProducerAdapter.java b/src/main/java/org/dbunit/dataset/stream/DataSetProducerAdapter.java
index 410926ebd..637a34976 100644
--- a/src/main/java/org/dbunit/dataset/stream/DataSetProducerAdapter.java
+++ b/src/main/java/org/dbunit/dataset/stream/DataSetProducerAdapter.java
@@ -53,11 +53,22 @@ public class DataSetProducerAdapter implements IDataSetProducer
private final ITableIterator _iterator;
private IDataSetConsumer _consumer = EMPTY_CONSUMER;
+ /**
+ * Creates a producer that reports the tables of the given iterator.
+ *
+ * @param iterator the iterator providing the tables to produce.
+ */
public DataSetProducerAdapter(ITableIterator iterator)
{
_iterator = iterator;
}
+ /**
+ * Creates a producer that reports the tables of the given dataset.
+ *
+ * @param dataSet the dataset providing the tables to produce.
+ * @throws DataSetException if the dataset's iterator cannot be created.
+ */
public DataSetProducerAdapter(IDataSet dataSet) throws DataSetException
{
_iterator = dataSet.iterator();
diff --git a/src/main/java/org/dbunit/dataset/stream/DefaultConsumer.java b/src/main/java/org/dbunit/dataset/stream/DefaultConsumer.java
index 8262578fc..eb78be9e6 100644
--- a/src/main/java/org/dbunit/dataset/stream/DefaultConsumer.java
+++ b/src/main/java/org/dbunit/dataset/stream/DefaultConsumer.java
@@ -33,6 +33,7 @@
*/
public class DefaultConsumer implements IDataSetConsumer
{
+
public void startDataSet() throws DataSetException
{
// no op
diff --git a/src/main/java/org/dbunit/dataset/stream/IDataSetConsumer.java b/src/main/java/org/dbunit/dataset/stream/IDataSetConsumer.java
index db0807cbf..24f06a7b3 100644
--- a/src/main/java/org/dbunit/dataset/stream/IDataSetConsumer.java
+++ b/src/main/java/org/dbunit/dataset/stream/IDataSetConsumer.java
@@ -36,12 +36,14 @@ public interface IDataSetConsumer
/**
* Receive notification of the beginning of a dataset. This method is
* invoked only once, before any other methods in this interface.
+ * @throws DataSetException if the notification cannot be processed.
*/
public void startDataSet() throws DataSetException;
/**
* Receive notification of the end of a dataset. This method is invoked only
* once, and it will be the last method invoked in this interface.
+ * @throws DataSetException if the notification cannot be processed.
*/
public void endDataSet() throws DataSetException;
@@ -51,11 +53,13 @@ public interface IDataSetConsumer
* corresponding {@link #endDataSet} event for every startTable
* event (even when the table is empty).
* @param metaData the table metadata
+ * @throws DataSetException if the notification cannot be processed.
*/
public void startTable(ITableMetaData metaData) throws DataSetException;
/**
* Receive notification of the end of a table.
+ * @throws DataSetException if the notification cannot be processed.
*/
public void endTable() throws DataSetException;
@@ -63,6 +67,7 @@ public interface IDataSetConsumer
* Receive notification of a table row. This method is invoked to report
* each row of a table.
* @param values The row values.
+ * @throws DataSetException if the notification cannot be processed.
*/
public void row(Object[] values) throws DataSetException;
}
diff --git a/src/main/java/org/dbunit/dataset/stream/IDataSetProducer.java b/src/main/java/org/dbunit/dataset/stream/IDataSetProducer.java
index 8c5c5f252..f36c0aa05 100644
--- a/src/main/java/org/dbunit/dataset/stream/IDataSetProducer.java
+++ b/src/main/java/org/dbunit/dataset/stream/IDataSetProducer.java
@@ -32,6 +32,12 @@
*/
public interface IDataSetProducer
{
+ /**
+ * Sets the consumer notified of this producer's dataset content.
+ *
+ * @param consumer the consumer to notify.
+ * @throws DataSetException if the consumer cannot be set.
+ */
public void setConsumer(IDataSetConsumer consumer) throws DataSetException;
/**
@@ -42,6 +48,8 @@ public interface IDataSetProducer
* This method is synchronous: it will not return until processing has ended.
* If a client application wants to terminate parsing early, it should
* throw an exception from the listener.
+ *
+ * @throws DataSetException if processing the dataset source fails.
*/
public void produce() throws DataSetException;
}
diff --git a/src/main/java/org/dbunit/dataset/stream/StreamingDataSet.java b/src/main/java/org/dbunit/dataset/stream/StreamingDataSet.java
index f7919bb88..97daf467a 100644
--- a/src/main/java/org/dbunit/dataset/stream/StreamingDataSet.java
+++ b/src/main/java/org/dbunit/dataset/stream/StreamingDataSet.java
@@ -47,6 +47,11 @@ public class StreamingDataSet extends AbstractDataSet
private IDataSetProducer _source;
private int _iteratorCount;
+ /**
+ * Creates a dataset that asynchronously consumes the given producer.
+ *
+ * @param source the producer to consume.
+ */
public StreamingDataSet(IDataSetProducer source)
{
_source = source;
@@ -81,7 +86,7 @@ protected ITableIterator createIterator(boolean reversed)
/**
* Not supported.
- * @throws UnsupportedOperationException
+ * @throws UnsupportedOperationException always.
*/
public String[] getTableNames() throws DataSetException
{
@@ -90,7 +95,7 @@ public String[] getTableNames() throws DataSetException
/**
* Not supported.
- * @throws UnsupportedOperationException
+ * @throws UnsupportedOperationException always.
*/
public ITableMetaData getTableMetaData(String tableName) throws DataSetException
{
@@ -101,7 +106,7 @@ public ITableMetaData getTableMetaData(String tableName) throws DataSetException
/**
* Not supported.
- * @throws UnsupportedOperationException
+ * @throws UnsupportedOperationException always.
*/
public ITable getTable(String tableName) throws DataSetException
{
diff --git a/src/main/java/org/dbunit/dataset/stream/StreamingIterator.java b/src/main/java/org/dbunit/dataset/stream/StreamingIterator.java
index 6bba4c535..bbc7101ab 100644
--- a/src/main/java/org/dbunit/dataset/stream/StreamingIterator.java
+++ b/src/main/java/org/dbunit/dataset/stream/StreamingIterator.java
@@ -71,7 +71,8 @@ public class StreamingIterator implements ITableIterator
* the given source in an asynchronous way. Therefore a Thread is
* created.
* @param source The source of the data
- * @throws DataSetException
+ * @throws DataSetException if the asynchronous producer thread is interrupted before
+ * producing its first element.
*/
public StreamingIterator(IDataSetProducer source) throws DataSetException
{
diff --git a/src/main/java/org/dbunit/dataset/xml/FlatDtdDataSet.java b/src/main/java/org/dbunit/dataset/xml/FlatDtdDataSet.java
index 1f733fda0..57b60390c 100644
--- a/src/main/java/org/dbunit/dataset/xml/FlatDtdDataSet.java
+++ b/src/main/java/org/dbunit/dataset/xml/FlatDtdDataSet.java
@@ -60,21 +60,44 @@ public class FlatDtdDataSet extends AbstractDataSet implements IDataSetConsumer
private boolean _ready = false;
+ /**
+ * Default constructor.
+ */
public FlatDtdDataSet()
{
initialize();
}
+ /**
+ * Creates a dataset from the DTD content of the given input stream.
+ *
+ * @param in the input stream to read the DTD from.
+ * @throws DataSetException if the DTD content is invalid.
+ * @throws IOException if the input stream cannot be read.
+ */
public FlatDtdDataSet(InputStream in) throws DataSetException, IOException
{
this(new FlatDtdProducer(new InputSource(in)));
}
+ /**
+ * Creates a dataset from the DTD content of the given reader.
+ *
+ * @param reader the reader to read the DTD from.
+ * @throws DataSetException if the DTD content is invalid.
+ * @throws IOException if the reader cannot be read.
+ */
public FlatDtdDataSet(Reader reader) throws DataSetException, IOException
{
this(new FlatDtdProducer(new InputSource(reader)));
}
+ /**
+ * Creates a dataset that synchronously consumes the specified producer.
+ *
+ * @param producer the producer to consume.
+ * @throws DataSetException if consuming the producer fails.
+ */
public FlatDtdDataSet(IDataSetProducer producer) throws DataSetException
{
initialize();
@@ -93,6 +116,11 @@ protected void initialize()
* Writes the specified dataset to the specified output stream as DTD,
* encoded in UTF-8, matching what the {@code InputStream} constructor's
* SAX parsing assumes absent an explicit encoding declaration.
+ *
+ * @param dataSet the dataset to write a DTD for.
+ * @param out the stream to write to.
+ * @throws IOException if writing fails.
+ * @throws DataSetException if reading the dataset fails.
* @see FlatDtdWriter
*/
public static void write(IDataSet dataSet, OutputStream out)
@@ -105,6 +133,11 @@ public static void write(IDataSet dataSet, OutputStream out)
/**
* Write the specified dataset to the specified writer as DTD.
+ *
+ * @param dataSet the dataset to write a DTD for.
+ * @param out the writer to write to.
+ * @throws IOException if writing fails.
+ * @throws DataSetException if reading the dataset fails.
* @see FlatDtdWriter
*/
public static void write(IDataSet dataSet, Writer out)
diff --git a/src/main/java/org/dbunit/dataset/xml/FlatDtdProducer.java b/src/main/java/org/dbunit/dataset/xml/FlatDtdProducer.java
index 5fc13a3fb..30fe73c48 100644
--- a/src/main/java/org/dbunit/dataset/xml/FlatDtdProducer.java
+++ b/src/main/java/org/dbunit/dataset/xml/FlatDtdProducer.java
@@ -109,15 +109,31 @@ public class FlatDtdProducer implements IDataSetProducer, EntityResolver, DeclHa
private String _rootModel;
private final Map _columnListMap = new HashMap();
+ /**
+ * Default constructor.
+ */
public FlatDtdProducer()
{
}
+ /**
+ * Creates a producer that reads the DTD from the given input source.
+ *
+ * @param inputSource the DTD input source.
+ */
public FlatDtdProducer(final InputSource inputSource)
{
_inputSource = inputSource;
}
+ /**
+ * Registers the given handler as the given XML reader's declaration handler.
+ *
+ * @param xmlReader the XML reader to configure.
+ * @param handler the declaration handler to register.
+ * @throws SAXNotRecognizedException if the reader does not recognize the declaration-handler property.
+ * @throws SAXNotSupportedException if the reader does not support the declaration-handler property.
+ */
public static void setDeclHandler(final XMLReader xmlReader, final DeclHandler handler)
throws SAXNotRecognizedException, SAXNotSupportedException
{
@@ -125,6 +141,14 @@ public static void setDeclHandler(final XMLReader xmlReader, final DeclHandler h
xmlReader.setProperty(DECL_HANDLER_PROPERTY_NAME, handler);
}
+ /**
+ * Registers the given handler as the given XML reader's lexical handler.
+ *
+ * @param xmlReader the XML reader to configure.
+ * @param handler the lexical handler to register.
+ * @throws SAXNotRecognizedException if the reader does not recognize the lexical-handler property.
+ * @throws SAXNotSupportedException if the reader does not support the lexical-handler property.
+ */
public static void setLexicalHandler(final XMLReader xmlReader, final LexicalHandler handler)
throws SAXNotRecognizedException, SAXNotSupportedException
{
@@ -337,6 +361,13 @@ private Column[] getColumns(final String tableName) throws DataSetException
return columns;
}
+ /**
+ * Strips DTD content-model syntax (parentheses, occurrence indicators) from the given
+ * table name, as parsed from an ELEMENT declaration.
+ *
+ * @param tableName the raw table name to clean up.
+ * @return the cleaned-up table name.
+ */
protected String cleanupTableName(final String tableName)
{
String cleaned = tableName;
diff --git a/src/main/java/org/dbunit/dataset/xml/FlatDtdWriter.java b/src/main/java/org/dbunit/dataset/xml/FlatDtdWriter.java
index 91538f930..c3045e726 100644
--- a/src/main/java/org/dbunit/dataset/xml/FlatDtdWriter.java
+++ b/src/main/java/org/dbunit/dataset/xml/FlatDtdWriter.java
@@ -45,24 +45,42 @@ public class FlatDtdWriter //implements IDataSetConsumer
*/
private static final Logger logger = LoggerFactory.getLogger(FlatDtdWriter.class);
+ /** Content model rendering child elements as a sequence, e.g. (A, B, C). */
public static final ContentModel SEQUENCE = new SequenceModel();
+ /** Content model rendering child elements as a choice, e.g. (A | B | C). */
public static final ContentModel CHOICE = new ChoiceModel();
private Writer _writer;
private ContentModel _contentModel;
+ /**
+ * Creates a writer that writes DTD content to the given writer, using the sequence content model.
+ *
+ * @param writer the writer to write to.
+ */
public FlatDtdWriter(Writer writer)
{
_writer = writer;
_contentModel = SEQUENCE;
}
+ /**
+ * Sets the content model used to render tables' child elements.
+ *
+ * @param contentModel the content model to use.
+ */
public void setContentModel(ContentModel contentModel)
{
logger.debug("setContentModel(contentModel={}) - start", contentModel);
_contentModel = contentModel;
}
+ /**
+ * Writes a DTD describing the given dataset's tables and columns.
+ *
+ * @param dataSet the dataset to write a DTD for.
+ * @throws DataSetException if reading the dataset fails.
+ */
public void write(IDataSet dataSet) throws DataSetException
{
logger.debug("write(dataSet={}) - start", dataSet);
@@ -149,6 +167,14 @@ public String toString()
return _name;
}
+ /**
+ * Writes the given table's content-model declaration.
+ *
+ * @param writer the writer to write to.
+ * @param tableName the table name.
+ * @param tableIndex the index of the table among tableCount, used to decide separators.
+ * @param tableCount the total number of tables being written.
+ */
public abstract void write(PrintWriter writer, String tableName,
int tableIndex, int tableCount);
}
diff --git a/src/main/java/org/dbunit/dataset/xml/FlatXmlDataSet.java b/src/main/java/org/dbunit/dataset/xml/FlatXmlDataSet.java
index 6ed6e5224..eac806d8f 100644
--- a/src/main/java/org/dbunit/dataset/xml/FlatXmlDataSet.java
+++ b/src/main/java/org/dbunit/dataset/xml/FlatXmlDataSet.java
@@ -101,7 +101,7 @@ public class FlatXmlDataSet extends CachedDataSet
/**
* Creates a new {@link FlatXmlDataSet} with the data of the given producer.
* @param flatXmlProducer The producer that provides the {@link FlatXmlDataSet} content
- * @throws DataSetException
+ * @throws DataSetException if the dataset cannot be built.
* @since 2.4.7
*/
public FlatXmlDataSet(FlatXmlProducer flatXmlProducer) throws DataSetException
@@ -111,6 +111,9 @@ public FlatXmlDataSet(FlatXmlProducer flatXmlProducer) throws DataSetException
/**
* Creates an FlatXmlDataSet object with the specified InputSource.
+ * @param source the XML input source.
+ * @throws IOException if the input cannot be read.
+ * @throws DataSetException if the dataset cannot be built.
* @deprecated since 2.4.7 - use {@link FlatXmlDataSetBuilder} to create a {@link FlatXmlDataSet}
*/
public FlatXmlDataSet(InputSource source) throws IOException, DataSetException
@@ -123,6 +126,8 @@ public FlatXmlDataSet(InputSource source) throws IOException, DataSetException
* Relative DOCTYPE uri are resolved from the xml file path.
*
* @param xmlFile the xml file
+ * @throws IOException if the input cannot be read.
+ * @throws DataSetException if the dataset cannot be built.
* @deprecated since 2.4.7 - use {@link FlatXmlDataSetBuilder} to create a {@link FlatXmlDataSet}
*/
public FlatXmlDataSet(File xmlFile) throws IOException, DataSetException
@@ -136,6 +141,8 @@ public FlatXmlDataSet(File xmlFile) throws IOException, DataSetException
*
* @param xmlFile the xml file
* @param dtdMetadata if false do not use DTD as metadata
+ * @throws IOException if the input cannot be read.
+ * @throws DataSetException if the dataset cannot be built.
* @deprecated since 2.4.7 - use {@link FlatXmlDataSetBuilder} to create a {@link FlatXmlDataSet}
*/
public FlatXmlDataSet(File xmlFile, boolean dtdMetadata)
@@ -152,6 +159,8 @@ public FlatXmlDataSet(File xmlFile, boolean dtdMetadata)
* @param dtdMetadata if false do not use DTD as metadata
* @param columnSensing Whether or not the columns should be sensed automatically. Every XML row
* is scanned for columns that have not been there in a previous column.
+ * @throws IOException if the input cannot be read.
+ * @throws DataSetException if the dataset cannot be built.
* @deprecated since 2.4.7 - use {@link FlatXmlDataSetBuilder} to create a {@link FlatXmlDataSet}
*/
public FlatXmlDataSet(File xmlFile, boolean dtdMetadata, boolean columnSensing)
@@ -169,6 +178,8 @@ public FlatXmlDataSet(File xmlFile, boolean dtdMetadata, boolean columnSensing)
* @param columnSensing Whether or not the columns should be sensed automatically. Every XML row
* is scanned for columns that have not been there in a previous column.
* @param caseSensitiveTableNames Whether or not this dataset should use case sensitive table names
+ * @throws IOException if the input cannot be read.
+ * @throws DataSetException if the dataset cannot be built.
* @deprecated since 2.4.7 - use {@link FlatXmlDataSetBuilder} to create a {@link FlatXmlDataSet}
*/
public FlatXmlDataSet(File xmlFile, boolean dtdMetadata, boolean columnSensing, boolean caseSensitiveTableNames)
@@ -182,6 +193,8 @@ public FlatXmlDataSet(File xmlFile, boolean dtdMetadata, boolean columnSensing,
* Relative DOCTYPE uri are resolved from the xml file path.
*
* @param xmlUrl the xml URL
+ * @throws IOException if the input cannot be read.
+ * @throws DataSetException if the dataset cannot be built.
* @deprecated since 2.4.7 - use {@link FlatXmlDataSetBuilder} to create a {@link FlatXmlDataSet}
*/
public FlatXmlDataSet(URL xmlUrl) throws IOException, DataSetException
@@ -195,6 +208,8 @@ public FlatXmlDataSet(URL xmlUrl) throws IOException, DataSetException
*
* @param xmlUrl the xml URL
* @param dtdMetadata if false do not use DTD as metadata
+ * @throws IOException if the input cannot be read.
+ * @throws DataSetException if the dataset cannot be built.
* @deprecated since 2.4.7 - use {@link FlatXmlDataSetBuilder} to create a {@link FlatXmlDataSet}
*/
public FlatXmlDataSet(URL xmlUrl, boolean dtdMetadata)
@@ -212,6 +227,8 @@ public FlatXmlDataSet(URL xmlUrl, boolean dtdMetadata)
* @param dtdMetadata if false do not use DTD as metadata
* @param columnSensing Whether or not the columns should be sensed automatically. Every XML row
* is scanned for columns that have not been there in a previous column.
+ * @throws IOException if the input cannot be read.
+ * @throws DataSetException if the dataset cannot be built.
* @deprecated since 2.4.7 - use {@link FlatXmlDataSetBuilder} to create a {@link FlatXmlDataSet}
*/
public FlatXmlDataSet(URL xmlUrl, boolean dtdMetadata, boolean columnSensing)
@@ -230,6 +247,8 @@ public FlatXmlDataSet(URL xmlUrl, boolean dtdMetadata, boolean columnSensing)
* @param columnSensing Whether or not the columns should be sensed automatically. Every XML row
* is scanned for columns that have not been there in a previous column.
* @param caseSensitiveTableNames Whether or not this dataset should use case sensitive table names
+ * @throws IOException if the input cannot be read.
+ * @throws DataSetException if the dataset cannot be built.
* @deprecated since 2.4.7 - use {@link FlatXmlDataSetBuilder} to create a {@link FlatXmlDataSet}
*/
public FlatXmlDataSet(URL xmlUrl, boolean dtdMetadata, boolean columnSensing, boolean caseSensitiveTableNames)
@@ -245,6 +264,8 @@ public FlatXmlDataSet(URL xmlUrl, boolean dtdMetadata, boolean columnSensing, bo
* Relative DOCTYPE uri are resolved from the current working directory.
*
* @param xmlReader the xml reader
+ * @throws IOException if the input cannot be read.
+ * @throws DataSetException if the dataset cannot be built.
* @deprecated since 2.4.7 - use {@link FlatXmlDataSetBuilder} to create a {@link FlatXmlDataSet}
*/
public FlatXmlDataSet(Reader xmlReader) throws IOException, DataSetException
@@ -258,6 +279,8 @@ public FlatXmlDataSet(Reader xmlReader) throws IOException, DataSetException
*
* @param xmlReader the xml reader
* @param dtdMetadata if false do not use DTD as metadata
+ * @throws IOException if the input cannot be read.
+ * @throws DataSetException if the dataset cannot be built.
* @deprecated since 2.4.7 - use {@link FlatXmlDataSetBuilder} to create a {@link FlatXmlDataSet}
*/
public FlatXmlDataSet(Reader xmlReader, boolean dtdMetadata)
@@ -276,6 +299,8 @@ public FlatXmlDataSet(Reader xmlReader, boolean dtdMetadata)
* is scanned for columns that have not been there in a previous column.
* @param caseSensitiveTableNames Whether or not this dataset should use case sensitive table names
* @since 2.4.3
+ * @throws IOException if the input cannot be read.
+ * @throws DataSetException if the dataset cannot be built.
* @deprecated since 2.4.7 - use {@link FlatXmlDataSetBuilder} to create a {@link FlatXmlDataSet}
*/
public FlatXmlDataSet(Reader xmlReader, boolean dtdMetadata, boolean columnSensing, boolean caseSensitiveTableNames)
@@ -290,6 +315,8 @@ public FlatXmlDataSet(Reader xmlReader, boolean dtdMetadata, boolean columnSensi
*
* @param xmlReader the xml reader
* @param dtdReader the dtd reader
+ * @throws IOException if the input cannot be read.
+ * @throws DataSetException if the dataset cannot be built.
* @deprecated since 2.4.7 - use {@link FlatXmlDataSetBuilder} to create a {@link FlatXmlDataSet}
*/
public FlatXmlDataSet(Reader xmlReader, Reader dtdReader)
@@ -303,6 +330,8 @@ public FlatXmlDataSet(Reader xmlReader, Reader dtdReader)
*
* @param xmlReader the xml reader
* @param metaDataSet the dataset used as metadata source.
+ * @throws IOException if the input cannot be read.
+ * @throws DataSetException if the dataset cannot be built.
* @deprecated since 2.4.7 - use {@link FlatXmlDataSetBuilder} to create a {@link FlatXmlDataSet}
*/
public FlatXmlDataSet(Reader xmlReader, IDataSet metaDataSet)
@@ -316,6 +345,8 @@ public FlatXmlDataSet(Reader xmlReader, IDataSet metaDataSet)
* Relative DOCTYPE uri are resolved from the current working directory.
*
* @param xmlStream the xml input stream
+ * @throws IOException if the input cannot be read.
+ * @throws DataSetException if the dataset cannot be built.
* @deprecated since 2.4.7 - use {@link FlatXmlDataSetBuilder} to create a {@link FlatXmlDataSet}
*/
public FlatXmlDataSet(InputStream xmlStream) throws IOException, DataSetException
@@ -329,6 +360,8 @@ public FlatXmlDataSet(InputStream xmlStream) throws IOException, DataSetExceptio
*
* @param xmlStream the xml input stream
* @param dtdMetadata if false do not use DTD as metadata
+ * @throws IOException if the input cannot be read.
+ * @throws DataSetException if the dataset cannot be built.
* @deprecated since 2.4.7 - use {@link FlatXmlDataSetBuilder} to create a {@link FlatXmlDataSet}
*/
public FlatXmlDataSet(InputStream xmlStream, boolean dtdMetadata)
@@ -343,6 +376,8 @@ public FlatXmlDataSet(InputStream xmlStream, boolean dtdMetadata)
*
* @param xmlStream the xml input stream
* @param dtdStream the dtd input stream
+ * @throws IOException if the input cannot be read.
+ * @throws DataSetException if the dataset cannot be built.
* @deprecated since 2.4.7 - use {@link FlatXmlDataSetBuilder} to create a {@link FlatXmlDataSet}
*/
public FlatXmlDataSet(InputStream xmlStream, InputStream dtdStream)
@@ -356,6 +391,8 @@ public FlatXmlDataSet(InputStream xmlStream, InputStream dtdStream)
*
* @param xmlStream the xml input stream
* @param metaDataSet the dataset used as metadata source.
+ * @throws IOException if the input cannot be read.
+ * @throws DataSetException if the dataset cannot be built.
* @deprecated since 2.4.7 - use {@link FlatXmlDataSetBuilder} to create a {@link FlatXmlDataSet}
*/
public FlatXmlDataSet(InputStream xmlStream, IDataSet metaDataSet)
@@ -366,6 +403,11 @@ public FlatXmlDataSet(InputStream xmlStream, IDataSet metaDataSet)
/**
* Write the specified dataset to the specified output stream as xml.
+ *
+ * @param dataSet the dataset to write.
+ * @param out the stream to write to.
+ * @throws IOException if writing fails.
+ * @throws DataSetException if reading the dataset fails.
*/
public static void write(IDataSet dataSet, OutputStream out)
throws IOException, DataSetException
@@ -379,6 +421,11 @@ public static void write(IDataSet dataSet, OutputStream out)
/**
* Write the specified dataset to the specified writer as xml.
+ *
+ * @param dataSet the dataset to write.
+ * @param writer the writer to write to.
+ * @throws IOException if writing fails.
+ * @throws DataSetException if reading the dataset fails.
*/
public static void write(IDataSet dataSet, Writer writer)
throws IOException, DataSetException
@@ -389,6 +436,12 @@ public static void write(IDataSet dataSet, Writer writer)
/**
* Write the specified dataset to the specified writer as xml.
+ *
+ * @param dataSet the dataset to write.
+ * @param writer the writer to write to.
+ * @param charset the charset to declare in the XML prolog, may be null.
+ * @throws IOException if writing fails.
+ * @throws DataSetException if reading the dataset fails.
*/
public static void write(IDataSet dataSet, Writer writer, Charset charset)
throws IOException, DataSetException
@@ -403,6 +456,11 @@ public static void write(IDataSet dataSet, Writer writer, Charset charset)
/**
* Write a DTD for the specified dataset to the specified output.
+ *
+ * @param dataSet the dataset to write a DTD for.
+ * @param out the stream to write to.
+ * @throws IOException if writing fails.
+ * @throws DataSetException if reading the dataset fails.
* @deprecated use {@link FlatDtdDataSet#write}
*/
public static void writeDtd(IDataSet dataSet, OutputStream out)
diff --git a/src/main/java/org/dbunit/dataset/xml/FlatXmlDataSetBuilder.java b/src/main/java/org/dbunit/dataset/xml/FlatXmlDataSetBuilder.java
index fb5f1eb8f..db13af6e5 100644
--- a/src/main/java/org/dbunit/dataset/xml/FlatXmlDataSetBuilder.java
+++ b/src/main/java/org/dbunit/dataset/xml/FlatXmlDataSetBuilder.java
@@ -91,7 +91,7 @@ public FlatXmlDataSetBuilder()
* Sets the flat XML input source from which the {@link FlatXmlDataSet} is to be built
* @param inputSource The flat XML input as {@link InputSource}
* @return The created {@link FlatXmlDataSet}
- * @throws DataSetException
+ * @throws DataSetException if the dataset cannot be built.
*/
public FlatXmlDataSet build(InputSource inputSource) throws DataSetException
{
@@ -102,7 +102,8 @@ public FlatXmlDataSet build(InputSource inputSource) throws DataSetException
* Sets the flat XML input source from which the {@link FlatXmlDataSet} is to be built
* @param xmlInputFile The flat XML input as {@link File}
* @return The created {@link FlatXmlDataSet}
- * @throws DataSetException
+ * @throws MalformedURLException if the file's path cannot be converted to a URL.
+ * @throws DataSetException if the dataset cannot be built.
*/
public FlatXmlDataSet build(File xmlInputFile) throws MalformedURLException, DataSetException
{
@@ -115,7 +116,7 @@ public FlatXmlDataSet build(File xmlInputFile) throws MalformedURLException, Dat
* Sets the flat XML input source from which the {@link FlatXmlDataSet} is to be built
* @param xmlInputUrl The flat XML input as {@link URL}
* @return The created {@link FlatXmlDataSet}
- * @throws DataSetException
+ * @throws DataSetException if the dataset cannot be built.
*/
public FlatXmlDataSet build(URL xmlInputUrl) throws DataSetException
{
@@ -127,7 +128,7 @@ public FlatXmlDataSet build(URL xmlInputUrl) throws DataSetException
* Sets the flat XML input source from which the {@link FlatXmlDataSet} is to be built
* @param xmlReader The flat XML input as {@link Reader}
* @return The created {@link FlatXmlDataSet}
- * @throws DataSetException
+ * @throws DataSetException if the dataset cannot be built.
*/
public FlatXmlDataSet build(Reader xmlReader) throws DataSetException
{
@@ -139,7 +140,7 @@ public FlatXmlDataSet build(Reader xmlReader) throws DataSetException
* Sets the flat XML input source from which the {@link FlatXmlDataSet} is to be built
* @param xmlInputStream The flat XML input as {@link InputStream}
* @return The created {@link FlatXmlDataSet}
- * @throws DataSetException
+ * @throws DataSetException if the dataset cannot be built.
*/
public FlatXmlDataSet build(InputStream xmlInputStream) throws DataSetException
{
@@ -161,10 +162,10 @@ private InputSource createInputSourceFromUrl(URL xmlInputUrl)
/**
* Set the metadata information (column info etc.) to be used. May come from a DTD.
* This has precedence to the other builder's properties.
- * @param metaDataSet
+ * @param metaDataSet the metadata source.
* @return this
*/
- public FlatXmlDataSetBuilder setMetaDataSet(IDataSet metaDataSet)
+ public FlatXmlDataSetBuilder setMetaDataSet(IDataSet metaDataSet)
{
this.metaDataSet = metaDataSet;
return this;
@@ -174,8 +175,8 @@ public FlatXmlDataSetBuilder setMetaDataSet(IDataSet metaDataSet)
* Set the metadata information (column info etc.) to be used from the given DTD input.
* This has precedence to the other builder's properties.
* @param dtdReader A reader that provides the DTD content
- * @throws DataSetException
- * @throws IOException
+ * @throws DataSetException if the DTD content is invalid.
+ * @throws IOException if the reader cannot be read.
* @return this
*/
public FlatXmlDataSetBuilder setMetaDataSetFromDtd(Reader dtdReader) throws DataSetException, IOException
@@ -187,9 +188,9 @@ public FlatXmlDataSetBuilder setMetaDataSetFromDtd(Reader dtdReader) throws Data
/**
* Set the metadata information (column info etc.) to be used from the given DTD input.
* This has precedence to the other builder's properties.
- * @param dtdStream
- * @throws DataSetException
- * @throws IOException
+ * @param dtdStream A stream that provides the DTD content
+ * @throws DataSetException if the DTD content is invalid.
+ * @throws IOException if the stream cannot be read.
* @return this
*/
public FlatXmlDataSetBuilder setMetaDataSetFromDtd(InputStream dtdStream) throws DataSetException, IOException
@@ -198,13 +199,17 @@ public FlatXmlDataSetBuilder setMetaDataSetFromDtd(InputStream dtdStream) throws
return this;
}
+ /**
+ * Whether or not DTD metadata is available to parse via a DTD handler.
+ * @return whether or not DTD metadata is available to parse via a DTD handler.
+ */
public boolean isDtdMetadata() {
return dtdMetadata;
}
/**
* Whether or not DTD metadata is available to parse via a DTD handler.
- * @param dtdMetadata
+ * @param dtdMetadata whether or not DTD metadata is available to parse via a DTD handler.
* @return this
*/
public FlatXmlDataSetBuilder setDtdMetadata(boolean dtdMetadata) {
@@ -212,6 +217,10 @@ public FlatXmlDataSetBuilder setDtdMetadata(boolean dtdMetadata) {
return this;
}
+ /**
+ * Whether or not column sensing is enabled.
+ * @return whether or not column sensing is enabled.
+ */
public boolean isColumnSensing() {
return columnSensing;
}
@@ -219,7 +228,7 @@ public boolean isColumnSensing() {
/**
* Since DBUnit 2.3.0 there is a functionality called "column sensing" which basically
* reads in the whole XML into a buffer and dynamically adds new columns as they appear.
- * @param columnSensing
+ * @param columnSensing whether or not column sensing is enabled.
* @return this
*/
public FlatXmlDataSetBuilder setColumnSensing(boolean columnSensing) {
@@ -227,13 +236,17 @@ public FlatXmlDataSetBuilder setColumnSensing(boolean columnSensing) {
return this;
}
+ /**
+ * Whether or not the created dataset should use case sensitive table names.
+ * @return whether or not the created dataset should use case sensitive table names.
+ */
public boolean isCaseSensitiveTableNames() {
return caseSensitiveTableNames;
}
/**
* Whether or not the created dataset should use case sensitive table names
- * @param caseSensitiveTableNames
+ * @param caseSensitiveTableNames whether or not the created dataset should use case sensitive table names.
* @return this
*/
public FlatXmlDataSetBuilder setCaseSensitiveTableNames(boolean caseSensitiveTableNames) {
@@ -265,10 +278,13 @@ private FlatXmlDataSet buildInternal(InputSource inputSource) throws DataSetExce
}
/**
+ * Creates the producer used to build the {@link FlatXmlDataSet}, using this builder's
+ * configured metadata source or properties.
+ *
* @param inputSource The XML input to be built
* @return The producer which is used to create the {@link FlatXmlDataSet}
*/
- protected FlatXmlProducer createProducer(InputSource inputSource)
+ protected FlatXmlProducer createProducer(InputSource inputSource)
{
logger.trace("createProducer(inputSource={}) - start", inputSource);
diff --git a/src/main/java/org/dbunit/dataset/xml/FlatXmlProducer.java b/src/main/java/org/dbunit/dataset/xml/FlatXmlProducer.java
index 47de7c681..adbbf8ec7 100644
--- a/src/main/java/org/dbunit/dataset/xml/FlatXmlProducer.java
+++ b/src/main/java/org/dbunit/dataset/xml/FlatXmlProducer.java
@@ -121,16 +121,34 @@ public class FlatXmlProducer extends DefaultHandler implements IDataSetProducer,
private Set _activeColumnNamesUpperCase;
+ /**
+ * Creates a producer that reads the given XML source, with DTD metadata enabled.
+ *
+ * @param xmlSource The input datasource
+ */
public FlatXmlProducer(InputSource xmlSource)
{
this(xmlSource, true);
}
+ /**
+ * Creates a producer that reads the given XML source.
+ *
+ * @param xmlSource The input datasource
+ * @param dtdMetadata Whether or not DTD metadata is available to parse via a DTD handler
+ */
public FlatXmlProducer(InputSource xmlSource, boolean dtdMetadata)
{
this(xmlSource, dtdMetadata, false);
}
+ /**
+ * Creates a producer that reads the given XML source, using the given dataset as
+ * the source of metadata instead of parsing a DTD.
+ *
+ * @param xmlSource The input datasource
+ * @param metaDataSet the dataset used as metadata source.
+ */
public FlatXmlProducer(InputSource xmlSource, IDataSet metaDataSet)
{
_inputSource = xmlSource;
@@ -140,14 +158,23 @@ public FlatXmlProducer(InputSource xmlSource, IDataSet metaDataSet)
initialize(false);
}
+ /**
+ * Creates a producer that reads the given XML source, with DTD metadata enabled and
+ * resolved using the given entity resolver.
+ *
+ * @param xmlSource The input datasource
+ * @param resolver the entity resolver used to resolve the DTD.
+ */
public FlatXmlProducer(InputSource xmlSource, EntityResolver resolver)
{
_inputSource = xmlSource;
_resolver = resolver;
initialize(true);
}
-
+
/**
+ * Creates a producer that reads the given XML source.
+ *
* @param xmlSource The input datasource
* @param dtdMetadata Whether or not DTD metadata is available to parse via a DTD handler
* @param columnSensing Whether or not the column sensing feature should be used (see FAQ)
@@ -156,8 +183,10 @@ public FlatXmlProducer(InputSource xmlSource, boolean dtdMetadata, boolean colum
{
this(xmlSource, dtdMetadata, columnSensing, false);
}
-
+
/**
+ * Creates a producer that reads the given XML source.
+ *
* @param xmlSource The input datasource
* @param dtdMetadata Whether or not DTD metadata is available to parse via a DTD handler
* @param columnSensing Whether or not the column sensing feature should be used (see FAQ)
@@ -184,6 +213,8 @@ private void initialize(boolean dtdMetadata)
}
/**
+ * Returns whether or not this producer works case sensitively.
+ *
* @return Whether or not this producer works case sensitively
* @since 2.4.7
*/
@@ -217,7 +248,7 @@ private ITableMetaData createTableMetaData(String tableName, Attributes attribut
* merges the existing columns with the potentially new ones.
* @param columnsToMerge List of extra columns found, which need to be merge back into the metadata.
* @return ITableMetaData The merged metadata object containing the new columns
- * @throws DataSetException
+ * @throws DataSetException if the metadata cannot be merged.
*/
private ITableMetaData mergeTableMetaData(List columnsToMerge, ITableMetaData originalMetaData) throws DataSetException
{
@@ -298,7 +329,7 @@ private void rebuildActiveColumnNames(ITableMetaData metaData) throws DataSetExc
*
*
* @param attributes Attributed for the current row.
- * @throws DataSetException
+ * @throws DataSetException if the metadata cannot be merged.
*/
protected void handleMissingColumns(Attributes attributes)
throws DataSetException
@@ -348,11 +379,21 @@ protected void handleMissingColumns(Attributes attributes)
}
}
+ /**
+ * Sets whether or not the column sensing feature should be used.
+ *
+ * @param columnSensing whether or not the column sensing feature should be used.
+ */
public void setColumnSensing(boolean columnSensing)
{
_columnSensing = columnSensing;
}
+ /**
+ * Sets whether or not the XML parser should validate against its DTD.
+ *
+ * @param validating whether or not the XML parser should validate against its DTD.
+ */
public void setValidating(boolean validating)
{
_validating = validating;
@@ -512,6 +553,17 @@ public void startElement(String uri, String localName, String qName,
}
}
+ /**
+ * Resolves the given attribute's column index in the active metadata and stores its value
+ * at that index in rowValues.
+ *
+ * @param attributes the current row's attributes.
+ * @param activeMetaData the active table metadata.
+ * @param rowValues the row value array to populate.
+ * @param i the index, into attributes, of the attribute to process.
+ * @throws DataSetException if resolving the column index fails.
+ * @throws NoSuchColumnException if the attribute has no corresponding column.
+ */
protected void determineAndSetRowValue(Attributes attributes,
ITableMetaData activeMetaData, Object[] rowValues, int i)
throws DataSetException, NoSuchColumnException
diff --git a/src/main/java/org/dbunit/dataset/xml/FlatXmlWriter.java b/src/main/java/org/dbunit/dataset/xml/FlatXmlWriter.java
index b41adc19a..2b33696b7 100644
--- a/src/main/java/org/dbunit/dataset/xml/FlatXmlWriter.java
+++ b/src/main/java/org/dbunit/dataset/xml/FlatXmlWriter.java
@@ -62,12 +62,20 @@ public class FlatXmlWriter implements IDataSetConsumer
private boolean _includeEmptyTable = false;
private String _systemId = null;
+ /**
+ * Creates a writer that writes XML to the given output stream, using the platform default charset.
+ *
+ * @param out the stream to write to.
+ * @throws IOException if the writer cannot be created.
+ */
public FlatXmlWriter(OutputStream out) throws IOException
{
this(out, null);
}
/**
+ * Creates a writer that writes XML to the given output stream.
+ *
* @param outputStream The stream to which the XML will be written.
* @param charset The character set to be used for the {@link XmlWriter}.
* Can be null. See {@link XmlWriter#XmlWriter(OutputStream, Charset)}.
@@ -78,23 +86,44 @@ public FlatXmlWriter(OutputStream outputStream, Charset charset)
_xmlWriter.enablePrettyPrint(true);
}
+ /**
+ * Creates a writer that writes XML to the given writer.
+ *
+ * @param writer the writer to write to.
+ */
public FlatXmlWriter(Writer writer)
{
_xmlWriter = new XmlWriter(writer);
_xmlWriter.enablePrettyPrint(true);
}
+ /**
+ * Creates a writer that writes XML to the given writer.
+ *
+ * @param writer the writer to write to.
+ * @param charset the charset to declare in the XML prolog, may be null.
+ */
public FlatXmlWriter(Writer writer, Charset charset)
{
_xmlWriter = new XmlWriter(writer, charset);
_xmlWriter.enablePrettyPrint(true);
}
+ /**
+ * Sets whether or not empty tables are included in the output.
+ *
+ * @param includeEmptyTable whether or not empty tables are included in the output.
+ */
public void setIncludeEmptyTable(boolean includeEmptyTable)
{
_includeEmptyTable = includeEmptyTable;
}
+ /**
+ * Sets the DOCTYPE system id to declare in the output.
+ *
+ * @param systemId the DOCTYPE system id.
+ */
public void setDocType(String systemId)
{
_systemId = systemId;
@@ -114,7 +143,7 @@ public void setPrettyPrint(boolean enabled)
/**
* Writes the given {@link IDataSet} using this writer.
* @param dataSet The {@link IDataSet} to be written
- * @throws DataSetException
+ * @throws DataSetException if reading the dataset fails.
*/
public void write(IDataSet dataSet) throws DataSetException
{
diff --git a/src/main/java/org/dbunit/dataset/xml/XmlDataSet.java b/src/main/java/org/dbunit/dataset/xml/XmlDataSet.java
index 50ba04e6c..8376630d7 100644
--- a/src/main/java/org/dbunit/dataset/xml/XmlDataSet.java
+++ b/src/main/java/org/dbunit/dataset/xml/XmlDataSet.java
@@ -68,6 +68,9 @@ public class XmlDataSet extends CachedDataSet
/**
* Creates an XmlDataSet with the specified xml reader.
+ *
+ * @param reader the reader to load the xml document from.
+ * @throws DataSetException if the document cannot be parsed.
*/
public XmlDataSet(Reader reader) throws DataSetException
{
@@ -76,6 +79,9 @@ public XmlDataSet(Reader reader) throws DataSetException
/**
* Creates an XmlDataSet with the specified xml input stream.
+ *
+ * @param in the stream to load the xml document from.
+ * @throws DataSetException if the document cannot be parsed.
*/
public XmlDataSet(InputStream in) throws DataSetException
{
@@ -84,6 +90,11 @@ public XmlDataSet(InputStream in) throws DataSetException
/**
* Write the specified dataset to the specified output stream as xml.
+ *
+ * @param dataSet the dataset to write.
+ * @param out the stream to write the xml document to.
+ * @throws IOException if writing to the stream fails.
+ * @throws DataSetException if the dataset cannot be read.
*/
public static void write(IDataSet dataSet, OutputStream out)
throws IOException, DataSetException
@@ -94,6 +105,12 @@ public static void write(IDataSet dataSet, OutputStream out)
/**
* Write the specified dataset to the specified output stream as xml (using specified encoding).
+ *
+ * @param dataSet the dataset to write.
+ * @param out the stream to write the xml document to.
+ * @param charset the character encoding to write the document in.
+ * @throws IOException if writing to the stream fails.
+ * @throws DataSetException if the dataset cannot be read.
*/
public static void write(IDataSet dataSet, OutputStream out, Charset charset)
throws IOException, DataSetException
@@ -107,6 +124,11 @@ public static void write(IDataSet dataSet, OutputStream out, Charset charset)
/**
* Write the specified dataset to the specified writer as xml.
+ *
+ * @param dataSet the dataset to write.
+ * @param writer the writer to write the xml document to.
+ * @throws IOException if writing to the writer fails.
+ * @throws DataSetException if the dataset cannot be read.
*/
public static void write(IDataSet dataSet, Writer writer)
throws IOException, DataSetException
@@ -117,6 +139,12 @@ public static void write(IDataSet dataSet, Writer writer)
/**
* Write the specified dataset to the specified writer as xml.
+ *
+ * @param dataSet the dataset to write.
+ * @param writer the writer to write the xml document to.
+ * @param charset the character encoding to write the document in.
+ * @throws IOException if writing to the writer fails.
+ * @throws DataSetException if the dataset cannot be read.
*/
public static void write(IDataSet dataSet, Writer writer, Charset charset)
throws IOException, DataSetException
diff --git a/src/main/java/org/dbunit/dataset/xml/XmlDataSetWriter.java b/src/main/java/org/dbunit/dataset/xml/XmlDataSetWriter.java
index 33d03ec79..9a9225e5d 100644
--- a/src/main/java/org/dbunit/dataset/xml/XmlDataSetWriter.java
+++ b/src/main/java/org/dbunit/dataset/xml/XmlDataSetWriter.java
@@ -74,6 +74,8 @@ public class XmlDataSetWriter implements IDataSetConsumer
/**
+ * Creates a new XmlDataSetWriter.
+ *
* @param outputStream The stream to which the XML will be written.
* @param charset The character set to be used for the {@link XmlWriter}.
* Can be null. See {@link XmlWriter#XmlWriter(OutputStream, Charset)}.
@@ -84,12 +86,23 @@ public XmlDataSetWriter(OutputStream outputStream, Charset charset)
_xmlWriter.enablePrettyPrint(true);
}
+ /**
+ * Creates a new XmlDataSetWriter.
+ *
+ * @param writer The writer to which the XML will be written.
+ */
public XmlDataSetWriter(Writer writer)
{
_xmlWriter = new XmlWriter(writer);
_xmlWriter.enablePrettyPrint(true);
}
+ /**
+ * Creates a new XmlDataSetWriter.
+ *
+ * @param writer The writer to which the XML will be written.
+ * @param charset The character set to be used for the {@link XmlWriter}.
+ */
public XmlDataSetWriter(Writer writer, Charset charset)
{
_xmlWriter = new XmlWriter(writer, charset);
@@ -119,7 +132,7 @@ public void setIncludeColumnComments(boolean includeColumnComments)
/**
* Writes the given {@link IDataSet} using this writer.
* @param dataSet The {@link IDataSet} to be written
- * @throws DataSetException
+ * @throws DataSetException if the dataset cannot be read.
*/
public void write(IDataSet dataSet) throws DataSetException
{
@@ -317,7 +330,7 @@ private void flushWriterQuietly()
* Can be overridden to add custom behavior.
* This implementation just invokes {@link XmlWriter#writeCData(String)}
* @param stringValue The value to be written
- * @throws IOException
+ * @throws IOException if writing to the underlying stream fails.
* @since 2.4.4
*/
protected void writeValueCData(String stringValue) throws IOException
@@ -331,7 +344,7 @@ protected void writeValueCData(String stringValue) throws IOException
* Can be overridden to add custom behavior.
* This implementation just invokes {@link XmlWriter#writeText(String)}.
* @param stringValue The value to be written
- * @throws IOException
+ * @throws IOException if writing to the underlying stream fails.
* @since 2.4.4
*/
protected void writeValue(String stringValue) throws IOException
@@ -341,6 +354,8 @@ protected void writeValue(String stringValue) throws IOException
}
/**
+ * Returns the {@link XmlWriter} that is used for writing out XML.
+ *
* @return The {@link XmlWriter} that is used for writing out XML.
* @since 2.4.4
*/
diff --git a/src/main/java/org/dbunit/dataset/xml/XmlProducer.java b/src/main/java/org/dbunit/dataset/xml/XmlProducer.java
index 9687dd058..4a62f0a5c 100644
--- a/src/main/java/org/dbunit/dataset/xml/XmlProducer.java
+++ b/src/main/java/org/dbunit/dataset/xml/XmlProducer.java
@@ -89,6 +89,11 @@ public class XmlProducer extends DefaultHandler
private StringBuilder _activeCharacters;
private List _activeRowValues;
+ /**
+ * Creates a producer reading XML from the given source.
+ *
+ * @param inputSource the source to read XML from.
+ */
public XmlProducer(InputSource inputSource)
{
_inputSource = inputSource;
@@ -108,6 +113,11 @@ private ITableMetaData createMetaData(String tableName, List columnNames)
return metaData;
}
+ /**
+ * Sets whether the XML parser validates the document against its DTD.
+ *
+ * @param validating true to validate the document against its DTD.
+ */
public void setValidating(boolean validating)
{
_validating = validating;
diff --git a/src/main/java/org/dbunit/dataset/yaml/YamlDataSet.java b/src/main/java/org/dbunit/dataset/yaml/YamlDataSet.java
index e392b1e8c..db166cbee 100644
--- a/src/main/java/org/dbunit/dataset/yaml/YamlDataSet.java
+++ b/src/main/java/org/dbunit/dataset/yaml/YamlDataSet.java
@@ -74,6 +74,10 @@ public class YamlDataSet extends CachedDataSet
/**
* Creates a YAML dataset based on a yaml file
+ *
+ * @param file the YAML file to load.
+ * @throws IOException if the file cannot be read.
+ * @throws DataSetException if the document cannot be parsed.
*/
public YamlDataSet(File file) throws IOException, DataSetException
{
@@ -84,6 +88,7 @@ public YamlDataSet(File file) throws IOException, DataSetException
* Creates a YAML dataset based on an inputstream
*
* @param inputStream An inputstream pointing to a YAML dataset
+ * @throws DataSetException if the document cannot be parsed.
*/
public YamlDataSet(InputStream inputStream) throws DataSetException
{
@@ -93,6 +98,10 @@ public YamlDataSet(InputStream inputStream) throws DataSetException
/**
* Writes the specified dataset to the specified output stream as YAML,
* encoded in UTF-8, matching what {@link YamlProducer} decodes.
+ *
+ * @param dataSet the dataset to write.
+ * @param out the stream to write the YAML document to.
+ * @throws DataSetException if the dataset cannot be read.
*/
public static void write(IDataSet dataSet, OutputStream out)
throws DataSetException
@@ -103,6 +112,10 @@ public static void write(IDataSet dataSet, OutputStream out)
/**
* Write the specified dataset to the specified writer as YAML.
+ *
+ * @param dataSet the dataset to write.
+ * @param out the writer to write the YAML document to.
+ * @throws DataSetException if the dataset cannot be read.
*/
public static void write(IDataSet dataSet, Writer out)
throws DataSetException
diff --git a/src/main/java/org/dbunit/dataset/yaml/YamlProducer.java b/src/main/java/org/dbunit/dataset/yaml/YamlProducer.java
index 1ff37d580..6eb97fc45 100644
--- a/src/main/java/org/dbunit/dataset/yaml/YamlProducer.java
+++ b/src/main/java/org/dbunit/dataset/yaml/YamlProducer.java
@@ -67,11 +67,22 @@ public class YamlProducer implements IDataSetProducer
private Yaml _yaml;
+ /**
+ * Creates a producer reading YAML from the given file.
+ *
+ * @param file the YAML file to read.
+ * @throws IOException if the file cannot be opened.
+ */
public YamlProducer(File file) throws IOException
{
this(new FileInputStream(file));
}
+ /**
+ * Creates a producer reading YAML from the given stream.
+ *
+ * @param inputStream the stream to read YAML from.
+ */
public YamlProducer(InputStream inputStream)
{
this._inputStream = inputStream;
diff --git a/src/main/java/org/dbunit/ext/db2/Db2Connection.java b/src/main/java/org/dbunit/ext/db2/Db2Connection.java
index 3d8dd98ab..0c59d7a10 100644
--- a/src/main/java/org/dbunit/ext/db2/Db2Connection.java
+++ b/src/main/java/org/dbunit/ext/db2/Db2Connection.java
@@ -39,6 +39,14 @@
public class Db2Connection extends DatabaseConnection
{
+ /**
+ * Creates a DB2 connection, pre-configuring the DB2-specific data type factory and
+ * metadata handler.
+ *
+ * @param connection the adapted JDBC connection.
+ * @param schema the database schema.
+ * @throws DatabaseUnitException if the connection cannot be adapted.
+ */
public Db2Connection(Connection connection, String schema) throws DatabaseUnitException
{
super(connection, schema);
diff --git a/src/main/java/org/dbunit/ext/db2/Db2MetadataHandler.java b/src/main/java/org/dbunit/ext/db2/Db2MetadataHandler.java
index e19e03cbc..601844c98 100644
--- a/src/main/java/org/dbunit/ext/db2/Db2MetadataHandler.java
+++ b/src/main/java/org/dbunit/ext/db2/Db2MetadataHandler.java
@@ -42,6 +42,9 @@ public class Db2MetadataHandler extends DefaultMetadataHandler {
private static final Logger logger = LoggerFactory.getLogger(Db2MetadataHandler.class);
+ /**
+ * Default constructor.
+ */
public Db2MetadataHandler() {
super();
}
diff --git a/src/main/java/org/dbunit/ext/h2/H2Connection.java b/src/main/java/org/dbunit/ext/h2/H2Connection.java
index 1c3f03827..c46418a04 100644
--- a/src/main/java/org/dbunit/ext/h2/H2Connection.java
+++ b/src/main/java/org/dbunit/ext/h2/H2Connection.java
@@ -37,6 +37,13 @@
*/
public class H2Connection extends DatabaseConnection
{
+ /**
+ * Creates an H2 connection, pre-configuring the H2-specific data type factory.
+ *
+ * @param connection the adapted JDBC connection.
+ * @param schema the database schema.
+ * @throws DatabaseUnitException if the connection cannot be adapted.
+ */
public H2Connection(Connection connection, String schema) throws DatabaseUnitException
{
super(connection, schema);
diff --git a/src/main/java/org/dbunit/ext/hsqldb/HsqldbConnection.java b/src/main/java/org/dbunit/ext/hsqldb/HsqldbConnection.java
index 71ea1fde9..85f8dc09e 100644
--- a/src/main/java/org/dbunit/ext/hsqldb/HsqldbConnection.java
+++ b/src/main/java/org/dbunit/ext/hsqldb/HsqldbConnection.java
@@ -37,6 +37,13 @@
*/
public class HsqldbConnection extends DatabaseConnection
{
+ /**
+ * Creates an HSQLDB connection, pre-configuring the HSQLDB-specific data type factory.
+ *
+ * @param connection the adapted JDBC connection.
+ * @param schema the database schema.
+ * @throws DatabaseUnitException if the connection cannot be adapted.
+ */
public HsqldbConnection(Connection connection, String schema) throws DatabaseUnitException
{
super(connection, schema);
diff --git a/src/main/java/org/dbunit/ext/mckoi/MckoiConnection.java b/src/main/java/org/dbunit/ext/mckoi/MckoiConnection.java
index dcff5128f..549146210 100644
--- a/src/main/java/org/dbunit/ext/mckoi/MckoiConnection.java
+++ b/src/main/java/org/dbunit/ext/mckoi/MckoiConnection.java
@@ -39,6 +39,13 @@
public class MckoiConnection extends DatabaseConnection
{
+ /**
+ * Creates a new MckoiConnection.
+ *
+ * @param connection the adapted JDBC connection.
+ * @param schema the database schema.
+ * @throws DatabaseUnitException if setting up the connection fails.
+ */
public MckoiConnection(Connection connection, String schema) throws DatabaseUnitException
{
super(connection, schema);
diff --git a/src/main/java/org/dbunit/ext/mckoi/MckoiDataTypeFactory.java b/src/main/java/org/dbunit/ext/mckoi/MckoiDataTypeFactory.java
index 9a9c643d6..2362d40d0 100644
--- a/src/main/java/org/dbunit/ext/mckoi/MckoiDataTypeFactory.java
+++ b/src/main/java/org/dbunit/ext/mckoi/MckoiDataTypeFactory.java
@@ -45,7 +45,6 @@ public class MckoiDataTypeFactory extends DefaultDataTypeFactory {
*/
private static final Logger logger = LoggerFactory.getLogger(MckoiDataTypeFactory.class);
-
/**
* Database product names supported.
*/
@@ -59,7 +58,6 @@ public Collection getValidDbProducts()
return DATABASE_PRODUCTS;
}
-
public DataType createDataType(int sqlType, String sqlTypeName) throws DataTypeException {
DataType retValue = super.createDataType(sqlType, sqlTypeName);
@@ -103,5 +101,3 @@ public DataType createDataType(int sqlType, String sqlTypeName) throws DataTypeE
}
}
-
-
diff --git a/src/main/java/org/dbunit/ext/mssql/DateTimeOffsetType.java b/src/main/java/org/dbunit/ext/mssql/DateTimeOffsetType.java
index 3ffb82707..5559a9b56 100644
--- a/src/main/java/org/dbunit/ext/mssql/DateTimeOffsetType.java
+++ b/src/main/java/org/dbunit/ext/mssql/DateTimeOffsetType.java
@@ -40,12 +40,16 @@
*/
public class DateTimeOffsetType extends AbstractDataType
{
+ /** JDBC SQL type code for Microsoft SQL Server's DATETIMEOFFSET type. */
public static final int TYPE = -155;
/** @see https://docs.microsoft.com/en-us/sql/t-sql/data-types/datetimeoffset-transact-sql?view=sql-server-2017 */
private static final DateTimeFormatter SQL_SERVER_FORMAT =
DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss[.n] xxx");
+ /**
+ * Default constructor.
+ */
public DateTimeOffsetType()
{
super("datetimeoffset", TYPE, OffsetDateTime.class, false);
diff --git a/src/main/java/org/dbunit/ext/mssql/InsertIdentityOperation.java b/src/main/java/org/dbunit/ext/mssql/InsertIdentityOperation.java
index 915e29ad0..6a0bc14ca 100644
--- a/src/main/java/org/dbunit/ext/mssql/InsertIdentityOperation.java
+++ b/src/main/java/org/dbunit/ext/mssql/InsertIdentityOperation.java
@@ -69,13 +69,16 @@ public class InsertIdentityOperation extends AbstractOperation
*/
private static final Logger logger = LoggerFactory.getLogger(InsertIdentityOperation.class);
+ /** {@link DatabaseOperation#INSERT}, decorated to enable MS SQL identity insert. */
public static final DatabaseOperation INSERT =
new InsertIdentityOperation(DatabaseOperation.INSERT);
+ /** {@link DatabaseOperation#DELETE_ALL} followed by {@link #INSERT}. */
public static final DatabaseOperation CLEAN_INSERT =
new CompositeOperation(DatabaseOperation.DELETE_ALL,
new InsertIdentityOperation(DatabaseOperation.INSERT));
+ /** {@link DatabaseOperation#REFRESH}, decorated to enable MS SQL identity insert. */
public static final DatabaseOperation REFRESH =
new InsertIdentityOperation(DatabaseOperation.REFRESH);
@@ -124,6 +127,8 @@ public boolean accept(String tableName, Column column)
/**
* Creates a new InsertIdentityOperation object that decorates the
* specified operation.
+ *
+ * @param operation the operation to decorate.
*/
public InsertIdentityOperation(DatabaseOperation operation)
{
diff --git a/src/main/java/org/dbunit/ext/mssql/MsSqlConnection.java b/src/main/java/org/dbunit/ext/mssql/MsSqlConnection.java
index 997b4414b..ef6e54f44 100644
--- a/src/main/java/org/dbunit/ext/mssql/MsSqlConnection.java
+++ b/src/main/java/org/dbunit/ext/mssql/MsSqlConnection.java
@@ -59,7 +59,7 @@ public class MsSqlConnection extends DatabaseConnection
*
* @param connection the adapted JDBC connection
* @param schema the database schema
- * @throws DatabaseUnitException
+ * @throws DatabaseUnitException if setting up the connection fails.
*/
public MsSqlConnection(Connection connection, String schema) throws DatabaseUnitException
{
@@ -72,7 +72,7 @@ public MsSqlConnection(Connection connection, String schema) throws DatabaseUnit
* Creates a new MsSqlConnection.
*
* @param connection the adapted JDBC connection
- * @throws DatabaseUnitException
+ * @throws DatabaseUnitException if setting up the connection fails.
*/
public MsSqlConnection(Connection connection) throws DatabaseUnitException
{
diff --git a/src/main/java/org/dbunit/ext/mssql/MsSqlDataTypeFactory.java b/src/main/java/org/dbunit/ext/mssql/MsSqlDataTypeFactory.java
index 5f3ea9ce6..41a4faa42 100644
--- a/src/main/java/org/dbunit/ext/mssql/MsSqlDataTypeFactory.java
+++ b/src/main/java/org/dbunit/ext/mssql/MsSqlDataTypeFactory.java
@@ -51,11 +51,15 @@ public class MsSqlDataTypeFactory extends DefaultDataTypeFactory
private static final DateTimeOffsetType DATE_TIME_OFFSET_TYPE = new DateTimeOffsetType();
+ /** JDBC type code for MS SQL Server's nchar type. */
public static final int NCHAR = -8;
+ /** JDBC type code for MS SQL Server's nvarchar type. */
public static final int NVARCHAR = -9;
+ /** JDBC type code for MS SQL Server's ntext type. */
public static final int NTEXT = -10;
+ /** JDBC type code for MS SQL Server 2005's ntext type. */
public static final int NTEXT_MSSQL_2005 = -16;
-
+
/**
* @see org.dbunit.dataset.datatype.IDbProductRelatable#getValidDbProducts()
*/
diff --git a/src/main/java/org/dbunit/ext/mssql/UniqueIdentifierType.java b/src/main/java/org/dbunit/ext/mssql/UniqueIdentifierType.java
index 79c567492..3e63af181 100644
--- a/src/main/java/org/dbunit/ext/mssql/UniqueIdentifierType.java
+++ b/src/main/java/org/dbunit/ext/mssql/UniqueIdentifierType.java
@@ -39,6 +39,9 @@
public class UniqueIdentifierType extends AbstractDataType {
static final String UNIQUE_IDENTIFIER_TYPE = "uniqueidentifier";
+ /**
+ * Default constructor.
+ */
public UniqueIdentifierType() {
super(UNIQUE_IDENTIFIER_TYPE, Types.CHAR, UUID.class, false);
}
diff --git a/src/main/java/org/dbunit/ext/mysql/MySqlConnection.java b/src/main/java/org/dbunit/ext/mysql/MySqlConnection.java
index 60f0fde0d..19fdc6578 100644
--- a/src/main/java/org/dbunit/ext/mysql/MySqlConnection.java
+++ b/src/main/java/org/dbunit/ext/mysql/MySqlConnection.java
@@ -36,6 +36,13 @@
*/
public class MySqlConnection extends DatabaseConnection
{
+ /**
+ * Creates a new MySqlConnection.
+ *
+ * @param connection the adapted JDBC connection.
+ * @param schema the database schema.
+ * @throws DatabaseUnitException if setting up the connection fails.
+ */
public MySqlConnection(Connection connection, String schema) throws DatabaseUnitException
{
super(connection, schema);
diff --git a/src/main/java/org/dbunit/ext/mysql/MySqlDataTypeFactory.java b/src/main/java/org/dbunit/ext/mysql/MySqlDataTypeFactory.java
index ae388af3b..7248812f8 100644
--- a/src/main/java/org/dbunit/ext/mysql/MySqlDataTypeFactory.java
+++ b/src/main/java/org/dbunit/ext/mysql/MySqlDataTypeFactory.java
@@ -40,7 +40,9 @@
*/
public class MySqlDataTypeFactory extends DefaultDataTypeFactory
{
+ /** Suffix MySQL appends to unsigned numeric type names, e.g. "INT UNSIGNED". */
public static final String UNSIGNED_SUFFIX = " UNSIGNED";
+ /** SQL type name reported by MySQL for an unsigned TINYINT column. */
public static final String SQL_TYPE_NAME_TINYINT_UNSIGNED = "TINYINT" + UNSIGNED_SUFFIX;
/**
@@ -51,6 +53,7 @@ public class MySqlDataTypeFactory extends DefaultDataTypeFactory
* Database product names supported.
*/
private static final Collection DATABASE_PRODUCTS = Arrays.asList(new String[] {"mysql"});
+
/**
* @see org.dbunit.dataset.datatype.IDbProductRelatable#getValidDbProducts()
*/
@@ -87,7 +90,6 @@ else if("bit".equalsIgnoreCase(sqlTypeName))
return DataType.TINYINT;
}
-
// Special handling for "TINYINT UNSIGNED"
if(SQL_TYPE_NAME_TINYINT_UNSIGNED.equalsIgnoreCase(sqlTypeName)){
return DataType.TINYINT; // It is a bit of a waste here - we could better use a "Short" instead of an "Integer" type
diff --git a/src/main/java/org/dbunit/ext/netezza/NetezzaDataTypeFactory.java b/src/main/java/org/dbunit/ext/netezza/NetezzaDataTypeFactory.java
index f89bcc927..e43c4431a 100644
--- a/src/main/java/org/dbunit/ext/netezza/NetezzaDataTypeFactory.java
+++ b/src/main/java/org/dbunit/ext/netezza/NetezzaDataTypeFactory.java
@@ -42,32 +42,59 @@ public class NetezzaDataTypeFactory extends DefaultDataTypeFactory
*/
private static final Logger logger = LoggerFactory.getLogger(NetezzaDataTypeFactory.class);
+ /** JDBC type code for Netezza's RECADDR type. */
public static final int RECADDR = 1;
+ /** JDBC type code for Netezza's NUMERIC type. */
public static final int NUMERIC = 2;
+ /** JDBC type code for Netezza's DECIMAL type. */
public static final int DECIMAL = 3;
+ /** JDBC type code for Netezza's INTEGER type. */
public static final int INTEGER = 4;
+ /** JDBC type code for Netezza's SMALLINT type. */
public static final int SMALLINT = 5;
+ /** JDBC type code for Netezza's DOUBLE type. */
public static final int DOUBLE = 8;
+ /** JDBC type code for Netezza's INTERVAL type. */
public static final int INTERVAL = 10;
+ /** JDBC type code for Netezza's BOOLEAN type. */
public static final int BOOLEAN = -7;
+ /** JDBC type code for Netezza's CHAR type. */
public static final int CHAR = -1;
+ /** JDBC type code for Netezza's FLOAT type. */
public static final int FLOAT = 6;
+ /** JDBC type code for Netezza's REAL type. */
public static final int REAL = 7;
+ /** JDBC type code for Netezza's VARCHAR type. */
public static final int VARCHAR = 12;
+ /** JDBC type code for Netezza's DATE type. */
public static final int DATE = 91;
+ /** JDBC type code for Netezza's TIME type. */
public static final int TIME = 92;
+ /** JDBC type code for Netezza's TIMESTAMP type. */
public static final int TIMESTAMP = 93;
+ /** JDBC type code for Netezza's TIMETZ type. */
public static final int TIMETZ = 1266;
+ /** JDBC type code for Netezza's UNKNOWN type. */
public static final int UNKNOWN = 18;
+ /** JDBC type code for Netezza's BYTEINT type. */
public static final int BYTEINT = -6;
+ /** JDBC type code for Netezza's INT8 type. */
public static final int INT8 = 20;
+ /** JDBC type code for Netezza's VARFIXEDCHAR type. */
public static final int VARFIXEDCHAR = 21;
+ /** JDBC type code for Netezza's NUCL type. */
public static final int NUCL = 22;
+ /** JDBC type code for Netezza's PROT type. */
public static final int PROT = 23;
+ /** JDBC type code for Netezza's BLOB type. */
public static final int BLOB = 24;
+ /** JDBC type code for Netezza's BIGINT type. */
public static final int BIGINT = -5;
+ /** JDBC type code for Netezza's NCHAR type. */
public static final int NCHAR = -8;
+ /** JDBC type code for Netezza's NVARCHAR type. */
public static final int NVARCHAR = -9;
+ /** JDBC type code for Netezza's NTEXT type. */
public static final int NTEXT = 27;
public DataType createDataType(int sqlType, String sqlTypeName) throws DataTypeException
@@ -122,4 +149,3 @@ public DataType createDataType(int sqlType, String sqlTypeName) throws DataTypeE
}
}
-
diff --git a/src/main/java/org/dbunit/ext/netezza/NetezzaMetadataHandler.java b/src/main/java/org/dbunit/ext/netezza/NetezzaMetadataHandler.java
index 72a1bd4d9..d7a99530d 100644
--- a/src/main/java/org/dbunit/ext/netezza/NetezzaMetadataHandler.java
+++ b/src/main/java/org/dbunit/ext/netezza/NetezzaMetadataHandler.java
@@ -45,6 +45,9 @@ public class NetezzaMetadataHandler implements IMetadataHandler
*/
private static final Logger logger = LoggerFactory.getLogger(NetezzaMetadataHandler.class);
+ /**
+ * Default constructor.
+ */
public NetezzaMetadataHandler()
{
logger.debug("Created object of metadatahandler");
diff --git a/src/main/java/org/dbunit/ext/oracle/Oracle10DataTypeFactory.java b/src/main/java/org/dbunit/ext/oracle/Oracle10DataTypeFactory.java
index 582d1116a..6c476b493 100644
--- a/src/main/java/org/dbunit/ext/oracle/Oracle10DataTypeFactory.java
+++ b/src/main/java/org/dbunit/ext/oracle/Oracle10DataTypeFactory.java
@@ -50,8 +50,9 @@ public class Oracle10DataTypeFactory extends OracleDataTypeFactory
*/
private static final Logger logger = LoggerFactory.getLogger(Oracle10DataTypeFactory.class);
-
+ /** Data type used for CLOB columns, handled as a character stream. */
protected static final DataType CLOB_AS_STRING = new StringDataType("CLOB", Types.CLOB);
+ /** Data type used for BLOB columns, handled as a binary stream. */
protected static final DataType BLOB_AS_STREAM = new BinaryStreamDataType("BLOB", Types.BLOB);
public DataType createDataType(int sqlType, String sqlTypeName) throws DataTypeException
diff --git a/src/main/java/org/dbunit/ext/oracle/OracleBlobDataType.java b/src/main/java/org/dbunit/ext/oracle/OracleBlobDataType.java
index e4fa1e046..4c020a218 100644
--- a/src/main/java/org/dbunit/ext/oracle/OracleBlobDataType.java
+++ b/src/main/java/org/dbunit/ext/oracle/OracleBlobDataType.java
@@ -103,7 +103,6 @@ private Object getBlob(Object value, Connection connection) throws TypeCastExcep
return tempBlob;
}
-
private void freeTemporaryBlob(oracle.sql.BLOB tempBlob) throws TypeCastException
{
logger.debug("freeTemporaryBlob(tempBlob={}) - start", tempBlob);
diff --git a/src/main/java/org/dbunit/ext/oracle/OracleClobDataType.java b/src/main/java/org/dbunit/ext/oracle/OracleClobDataType.java
index 78bf740dd..4d923bb48 100644
--- a/src/main/java/org/dbunit/ext/oracle/OracleClobDataType.java
+++ b/src/main/java/org/dbunit/ext/oracle/OracleClobDataType.java
@@ -71,6 +71,14 @@ public void setSqlValue(final Object value, final int column,
statement.setObject(column, getClob(value, statement.getConnection()));
}
+ /**
+ * Writes the given value into a temporary CLOB on the given connection.
+ *
+ * @param value the value to write, cast to a String.
+ * @param connection the connection to create the temporary CLOB on.
+ * @return the populated temporary CLOB.
+ * @throws TypeCastException if the value cannot be cast or writing fails.
+ */
protected Object getClob(final Object value, final Connection connection)
throws TypeCastException
{
diff --git a/src/main/java/org/dbunit/ext/oracle/OracleConnection.java b/src/main/java/org/dbunit/ext/oracle/OracleConnection.java
index ef25eceb7..dc4a2b644 100644
--- a/src/main/java/org/dbunit/ext/oracle/OracleConnection.java
+++ b/src/main/java/org/dbunit/ext/oracle/OracleConnection.java
@@ -40,9 +40,9 @@ public class OracleConnection extends DatabaseConnection
/**
* Creates a oracle connection. Beware that the given schema is passed in to the parent class
* as "upper case" string.
- * @param connection
+ * @param connection the adapted JDBC connection.
* @param schema The schema name
- * @throws DatabaseUnitException
+ * @throws DatabaseUnitException if setting up the connection fails.
*/
public OracleConnection(Connection connection, String schema) throws DatabaseUnitException
{
diff --git a/src/main/java/org/dbunit/ext/oracle/OracleDataTypeFactory.java b/src/main/java/org/dbunit/ext/oracle/OracleDataTypeFactory.java
index 9730a1197..3024dbfe6 100644
--- a/src/main/java/org/dbunit/ext/oracle/OracleDataTypeFactory.java
+++ b/src/main/java/org/dbunit/ext/oracle/OracleDataTypeFactory.java
@@ -50,15 +50,22 @@ public class OracleDataTypeFactory extends DefaultDataTypeFactory
*/
private static final Collection DATABASE_PRODUCTS = Arrays.asList(new String[] {"oracle"});
+ /** Data type for Oracle BLOB columns. */
public static final DataType ORACLE_BLOB = new OracleBlobDataType();
+ /** Data type for Oracle CLOB columns. */
public static final DataType ORACLE_CLOB = new OracleClobDataType();
+ /** Data type for Oracle NCLOB columns. */
public static final DataType ORACLE_NCLOB = new OracleNClobDataType();
+ /** Data type for Oracle XMLTYPE columns. */
public static final DataType ORACLE_XMLTYPE = new OracleXMLTypeDataType();
+ /** Data type for Oracle SDO_GEOMETRY columns. */
public static final DataType ORACLE_SDO_GEOMETRY_TYPE = new OracleSdoGeometryDataType();
-
+
+ /** Data type for Oracle LONG RAW columns. */
public static final DataType LONG_RAW = new BinaryStreamDataType(
"LONG RAW", Types.LONGVARBINARY);
-
+
+ /** Data type for Oracle ROWID columns. */
public static final DataType ROWID_TYPE = new StringDataType("ROWID", Types.OTHER);
/**
@@ -163,4 +170,3 @@ public DataType createDataType(int sqlType, String sqlTypeName) throws DataTypeE
}
}
-
diff --git a/src/main/java/org/dbunit/ext/oracle/OracleSdoElemInfoArray.java b/src/main/java/org/dbunit/ext/oracle/OracleSdoElemInfoArray.java
index 013b8623a..7473ec130 100644
--- a/src/main/java/org/dbunit/ext/oracle/OracleSdoElemInfoArray.java
+++ b/src/main/java/org/dbunit/ext/oracle/OracleSdoElemInfoArray.java
@@ -42,21 +42,36 @@
*/
public class OracleSdoElemInfoArray implements ORAData, ORADataFactory
{
+ /** The Oracle SQL type name backing this array, MDSYS.SDO_ELEM_INFO_ARRAY. */
public static final String _SQL_NAME = "MDSYS.SDO_ELEM_INFO_ARRAY";
+ /** The Oracle JDBC type code backing this array, {@link OracleTypes#ARRAY}. */
public static final int _SQL_TYPECODE = OracleTypes.ARRAY;
MutableArray _array;
private static final OracleSdoElemInfoArray _OracleSdoElemInfoArrayFactory = new OracleSdoElemInfoArray();
+ /**
+ * Returns the shared {@link ORADataFactory} for this class.
+ *
+ * @return the shared {@link ORADataFactory} for this class.
+ */
public static ORADataFactory getORADataFactory()
{ return _OracleSdoElemInfoArrayFactory; }
/* constructors */
+ /**
+ * Default constructor.
+ */
public OracleSdoElemInfoArray()
{
this((java.math.BigDecimal[])null);
}
+ /**
+ * Constructs an array wrapping the given elements.
+ *
+ * @param a the element values.
+ */
public OracleSdoElemInfoArray(java.math.BigDecimal[] a)
{
_array = new MutableArray(2, a, null);
@@ -71,58 +86,123 @@ public Datum toDatum(Connection c) throws SQLException
/* ORADataFactory interface */
public ORAData create(Datum d, int sqlType) throws SQLException
{
- if (d == null) return null;
+ if (d == null) return null;
OracleSdoElemInfoArray a = new OracleSdoElemInfoArray();
a._array = new MutableArray(2, (ARRAY) d, null);
return a;
}
+ /**
+ * Returns the number of elements in the array.
+ *
+ * @return the number of elements in the array.
+ * @throws SQLException if the underlying array cannot be read.
+ */
public int length() throws SQLException
{
return _array.length();
}
+ /**
+ * Returns the JDBC type code of the array's base element type.
+ *
+ * @return the JDBC type code of the array's base element type.
+ * @throws SQLException if the underlying array cannot be read.
+ */
public int getBaseType() throws SQLException
{
return _array.getBaseType();
}
+ /**
+ * Returns the SQL type name of the array's base element type.
+ *
+ * @return the SQL type name of the array's base element type.
+ * @throws SQLException if the underlying array cannot be read.
+ */
public String getBaseTypeName() throws SQLException
{
return _array.getBaseTypeName();
}
+ /**
+ * Returns the descriptor of the underlying Oracle array.
+ *
+ * @return the descriptor of the underlying Oracle array.
+ * @throws SQLException if the underlying array cannot be read.
+ */
public ArrayDescriptor getDescriptor() throws SQLException
{
return _array.getDescriptor();
}
/* array accessor methods */
+ /**
+ * Returns the array's elements.
+ *
+ * @return the array's elements.
+ * @throws SQLException if the underlying array cannot be read.
+ */
public java.math.BigDecimal[] getArray() throws SQLException
{
return (java.math.BigDecimal[]) _array.getObjectArray();
}
+ /**
+ * Returns a range of the array's elements.
+ *
+ * @param index the index of the first element to return.
+ * @param count the number of elements to return.
+ * @return the requested range of the array's elements.
+ * @throws SQLException if the underlying array cannot be read.
+ */
public java.math.BigDecimal[] getArray(long index, int count) throws SQLException
{
return (java.math.BigDecimal[]) _array.getObjectArray(index, count);
}
+ /**
+ * Replaces the array's elements.
+ *
+ * @param a the new element values.
+ * @throws SQLException if the underlying array cannot be written.
+ */
public void setArray(java.math.BigDecimal[] a) throws SQLException
{
_array.setObjectArray(a);
}
+ /**
+ * Replaces a range of the array's elements starting at the given index.
+ *
+ * @param a the new element values.
+ * @param index the index of the first element to replace.
+ * @throws SQLException if the underlying array cannot be written.
+ */
public void setArray(java.math.BigDecimal[] a, long index) throws SQLException
{
_array.setObjectArray(a, index);
}
+ /**
+ * Returns a single element of the array.
+ *
+ * @param index the index of the element to return.
+ * @return the element at the given index.
+ * @throws SQLException if the underlying array cannot be read.
+ */
public java.math.BigDecimal getElement(long index) throws SQLException
{
return (java.math.BigDecimal) _array.getObjectElement(index);
}
+ /**
+ * Replaces a single element of the array.
+ *
+ * @param a the new element value.
+ * @param index the index of the element to replace.
+ * @throws SQLException if the underlying array cannot be written.
+ */
public void setElement(java.math.BigDecimal a, long index) throws SQLException
{
_array.setObjectElement(a, index);
diff --git a/src/main/java/org/dbunit/ext/oracle/OracleSdoGeometry.java b/src/main/java/org/dbunit/ext/oracle/OracleSdoGeometry.java
index 4b2124fc6..a3af97a66 100644
--- a/src/main/java/org/dbunit/ext/oracle/OracleSdoGeometry.java
+++ b/src/main/java/org/dbunit/ext/oracle/OracleSdoGeometry.java
@@ -41,12 +41,17 @@
*/
public class OracleSdoGeometry implements ORAData, ORADataFactory
{
+ /** The Oracle SQL type name backing this struct, MDSYS.SDO_GEOMETRY. */
public static final String _SQL_NAME = "MDSYS.SDO_GEOMETRY";
+ /** The Oracle JDBC type code backing this struct, {@link OracleTypes#STRUCT}. */
public static final int _SQL_TYPECODE = OracleTypes.STRUCT;
+ /** The underlying mutable struct holding this geometry's attribute values. */
protected MutableStruct _struct;
+ /** The JDBC type codes of this struct's attributes, in declaration order. */
protected static int[] _sqlType = { 2,2,2002,2003,2003 };
+ /** The {@link ORADataFactory} for each struct-typed attribute, indexed by attribute position. */
protected static ORADataFactory[] _factory = new ORADataFactory[5];
static
{
@@ -54,15 +59,39 @@ public class OracleSdoGeometry implements ORAData, ORADataFactory
_factory[3] = OracleSdoElemInfoArray.getORADataFactory();
_factory[4] = OracleSdoOrdinateArray.getORADataFactory();
}
+ /** The shared {@link ORADataFactory} instance for this class. */
protected static final OracleSdoGeometry _OracleSdoGeometryFactory = new OracleSdoGeometry();
+ /**
+ * Returns the shared {@link ORADataFactory} for this class.
+ *
+ * @return the shared {@link ORADataFactory} for this class.
+ */
public static ORADataFactory getORADataFactory()
{ return _OracleSdoGeometryFactory; }
/* constructors */
+ /**
+ * Initializes {@link #_struct} when requested.
+ *
+ * @param init {@code true} to (re)create {@link #_struct}.
+ */
protected void _init_struct(boolean init)
{ if (init) _struct = new MutableStruct(new Object[5], _sqlType, _factory); }
+ /**
+ * Default constructor.
+ */
public OracleSdoGeometry()
{ _init_struct(true); }
+ /**
+ * Constructs a geometry with the given attribute values.
+ *
+ * @param sdoGtype the SDO_GTYPE attribute.
+ * @param sdoSrid the SDO_SRID attribute.
+ * @param sdoPoint the SDO_POINT attribute.
+ * @param sdoElemInfo the SDO_ELEM_INFO attribute.
+ * @param sdoOrdinates the SDO_ORDINATES attribute.
+ * @throws SQLException if setting an attribute fails.
+ */
public OracleSdoGeometry(java.math.BigDecimal sdoGtype, java.math.BigDecimal sdoSrid, OracleSdoPointType sdoPoint, OracleSdoElemInfoArray sdoElemInfo, OracleSdoOrdinateArray sdoOrdinates) throws SQLException
{ _init_struct(true);
setSdoGtype(sdoGtype);
@@ -82,45 +111,114 @@ public Datum toDatum(Connection c) throws SQLException
/* ORADataFactory interface */
public ORAData create(Datum d, int sqlType) throws SQLException
{ return create(null, d, sqlType); }
+ /**
+ * Populates (or creates) an {@code OracleSdoGeometry} from the given datum.
+ *
+ * @param o the instance to populate, or {@code null} to create a new one.
+ * @param d the source datum, or {@code null} to return {@code null}.
+ * @param sqlType the JDBC type code of the source datum.
+ * @return the populated instance, or {@code null} if {@code d} is {@code null}.
+ * @throws SQLException if reading the datum fails.
+ */
protected ORAData create(OracleSdoGeometry o, Datum d, int sqlType) throws SQLException
{
- if (d == null) return null;
+ if (d == null) return null;
if (o == null) o = new OracleSdoGeometry();
o._struct = new MutableStruct((STRUCT) d, _sqlType, _factory);
return o;
}
/* accessor methods */
+ /**
+ * Returns the SDO_GTYPE attribute.
+ *
+ * @return the SDO_GTYPE attribute.
+ * @throws SQLException if the underlying struct cannot be read.
+ */
public java.math.BigDecimal getSdoGtype() throws SQLException
{ return (java.math.BigDecimal) _struct.getAttribute(0); }
+ /**
+ * Sets the SDO_GTYPE attribute.
+ *
+ * @param sdoGtype the new SDO_GTYPE attribute value.
+ * @throws SQLException if the underlying struct cannot be written.
+ */
public void setSdoGtype(java.math.BigDecimal sdoGtype) throws SQLException
{ _struct.setAttribute(0, sdoGtype); }
+ /**
+ * Returns the SDO_SRID attribute.
+ *
+ * @return the SDO_SRID attribute.
+ * @throws SQLException if the underlying struct cannot be read.
+ */
public java.math.BigDecimal getSdoSrid() throws SQLException
{ return (java.math.BigDecimal) _struct.getAttribute(1); }
+ /**
+ * Sets the SDO_SRID attribute.
+ *
+ * @param sdoSrid the new SDO_SRID attribute value.
+ * @throws SQLException if the underlying struct cannot be written.
+ */
public void setSdoSrid(java.math.BigDecimal sdoSrid) throws SQLException
{ _struct.setAttribute(1, sdoSrid); }
+ /**
+ * Returns the SDO_POINT attribute.
+ *
+ * @return the SDO_POINT attribute.
+ * @throws SQLException if the underlying struct cannot be read.
+ */
public OracleSdoPointType getSdoPoint() throws SQLException
{ return (OracleSdoPointType) _struct.getAttribute(2); }
+ /**
+ * Sets the SDO_POINT attribute.
+ *
+ * @param sdoPoint the new SDO_POINT attribute value.
+ * @throws SQLException if the underlying struct cannot be written.
+ */
public void setSdoPoint(OracleSdoPointType sdoPoint) throws SQLException
{ _struct.setAttribute(2, sdoPoint); }
+ /**
+ * Returns the SDO_ELEM_INFO attribute.
+ *
+ * @return the SDO_ELEM_INFO attribute.
+ * @throws SQLException if the underlying struct cannot be read.
+ */
public OracleSdoElemInfoArray getSdoElemInfo() throws SQLException
{ return (OracleSdoElemInfoArray) _struct.getAttribute(3); }
+ /**
+ * Sets the SDO_ELEM_INFO attribute.
+ *
+ * @param sdoElemInfo the new SDO_ELEM_INFO attribute value.
+ * @throws SQLException if the underlying struct cannot be written.
+ */
public void setSdoElemInfo(OracleSdoElemInfoArray sdoElemInfo) throws SQLException
{ _struct.setAttribute(3, sdoElemInfo); }
+ /**
+ * Returns the SDO_ORDINATES attribute.
+ *
+ * @return the SDO_ORDINATES attribute.
+ * @throws SQLException if the underlying struct cannot be read.
+ */
public OracleSdoOrdinateArray getSdoOrdinates() throws SQLException
{ return (OracleSdoOrdinateArray) _struct.getAttribute(4); }
+ /**
+ * Sets the SDO_ORDINATES attribute.
+ *
+ * @param sdoOrdinates the new SDO_ORDINATES attribute value.
+ * @throws SQLException if the underlying struct cannot be written.
+ */
public void setSdoOrdinates(OracleSdoOrdinateArray sdoOrdinates) throws SQLException
{ _struct.setAttribute(4, sdoOrdinates); }
diff --git a/src/main/java/org/dbunit/ext/oracle/OracleSdoOrdinateArray.java b/src/main/java/org/dbunit/ext/oracle/OracleSdoOrdinateArray.java
index 297deaef3..ef73dc76f 100644
--- a/src/main/java/org/dbunit/ext/oracle/OracleSdoOrdinateArray.java
+++ b/src/main/java/org/dbunit/ext/oracle/OracleSdoOrdinateArray.java
@@ -42,21 +42,36 @@
*/
public class OracleSdoOrdinateArray implements ORAData, ORADataFactory
{
+ /** The Oracle SQL type name backing this array, MDSYS.SDO_ORDINATE_ARRAY. */
public static final String _SQL_NAME = "MDSYS.SDO_ORDINATE_ARRAY";
+ /** The Oracle JDBC type code backing this array, {@link OracleTypes#ARRAY}. */
public static final int _SQL_TYPECODE = OracleTypes.ARRAY;
MutableArray _array;
private static final OracleSdoOrdinateArray _OracleSdoOrdinateArrayFactory = new OracleSdoOrdinateArray();
+ /**
+ * Returns the shared {@link ORADataFactory} for this class.
+ *
+ * @return the shared {@link ORADataFactory} for this class.
+ */
public static ORADataFactory getORADataFactory()
{ return _OracleSdoOrdinateArrayFactory; }
/* constructors */
+ /**
+ * Default constructor.
+ */
public OracleSdoOrdinateArray()
{
this((java.math.BigDecimal[])null);
}
+ /**
+ * Constructs an array wrapping the given elements.
+ *
+ * @param a the element values.
+ */
public OracleSdoOrdinateArray(java.math.BigDecimal[] a)
{
_array = new MutableArray(2, a, null);
@@ -71,58 +86,123 @@ public Datum toDatum(Connection c) throws SQLException
/* ORADataFactory interface */
public ORAData create(Datum d, int sqlType) throws SQLException
{
- if (d == null) return null;
+ if (d == null) return null;
OracleSdoOrdinateArray a = new OracleSdoOrdinateArray();
a._array = new MutableArray(2, (ARRAY) d, null);
return a;
}
+ /**
+ * Returns the number of elements in the array.
+ *
+ * @return the number of elements in the array.
+ * @throws SQLException if the underlying array cannot be read.
+ */
public int length() throws SQLException
{
return _array.length();
}
+ /**
+ * Returns the JDBC type code of the array's base element type.
+ *
+ * @return the JDBC type code of the array's base element type.
+ * @throws SQLException if the underlying array cannot be read.
+ */
public int getBaseType() throws SQLException
{
return _array.getBaseType();
}
+ /**
+ * Returns the SQL type name of the array's base element type.
+ *
+ * @return the SQL type name of the array's base element type.
+ * @throws SQLException if the underlying array cannot be read.
+ */
public String getBaseTypeName() throws SQLException
{
return _array.getBaseTypeName();
}
+ /**
+ * Returns the descriptor of the underlying Oracle array.
+ *
+ * @return the descriptor of the underlying Oracle array.
+ * @throws SQLException if the underlying array cannot be read.
+ */
public ArrayDescriptor getDescriptor() throws SQLException
{
return _array.getDescriptor();
}
/* array accessor methods */
+ /**
+ * Returns the array's elements.
+ *
+ * @return the array's elements.
+ * @throws SQLException if the underlying array cannot be read.
+ */
public java.math.BigDecimal[] getArray() throws SQLException
{
return (java.math.BigDecimal[]) _array.getObjectArray();
}
+ /**
+ * Returns a range of the array's elements.
+ *
+ * @param index the index of the first element to return.
+ * @param count the number of elements to return.
+ * @return the requested range of the array's elements.
+ * @throws SQLException if the underlying array cannot be read.
+ */
public java.math.BigDecimal[] getArray(long index, int count) throws SQLException
{
return (java.math.BigDecimal[]) _array.getObjectArray(index, count);
}
+ /**
+ * Replaces the array's elements.
+ *
+ * @param a the new element values.
+ * @throws SQLException if the underlying array cannot be written.
+ */
public void setArray(java.math.BigDecimal[] a) throws SQLException
{
_array.setObjectArray(a);
}
+ /**
+ * Replaces a range of the array's elements starting at the given index.
+ *
+ * @param a the new element values.
+ * @param index the index of the first element to replace.
+ * @throws SQLException if the underlying array cannot be written.
+ */
public void setArray(java.math.BigDecimal[] a, long index) throws SQLException
{
_array.setObjectArray(a, index);
}
+ /**
+ * Returns a single element of the array.
+ *
+ * @param index the index of the element to return.
+ * @return the element at the given index.
+ * @throws SQLException if the underlying array cannot be read.
+ */
public java.math.BigDecimal getElement(long index) throws SQLException
{
return (java.math.BigDecimal) _array.getObjectElement(index);
}
+ /**
+ * Replaces a single element of the array.
+ *
+ * @param a the new element value.
+ * @param index the index of the element to replace.
+ * @throws SQLException if the underlying array cannot be written.
+ */
public void setElement(java.math.BigDecimal a, long index) throws SQLException
{
_array.setObjectElement(a, index);
diff --git a/src/main/java/org/dbunit/ext/oracle/OracleSdoPointType.java b/src/main/java/org/dbunit/ext/oracle/OracleSdoPointType.java
index 6454e4009..c9827f180 100644
--- a/src/main/java/org/dbunit/ext/oracle/OracleSdoPointType.java
+++ b/src/main/java/org/dbunit/ext/oracle/OracleSdoPointType.java
@@ -41,22 +41,49 @@
*/
public class OracleSdoPointType implements ORAData, ORADataFactory
{
+ /** The Oracle SQL type name backing this struct, MDSYS.SDO_POINT_TYPE. */
public static final String _SQL_NAME = "MDSYS.SDO_POINT_TYPE";
+ /** The Oracle JDBC type code backing this struct, {@link OracleTypes#STRUCT}. */
public static final int _SQL_TYPECODE = OracleTypes.STRUCT;
+ /** The underlying mutable struct holding this point's attribute values. */
protected MutableStruct _struct;
+ /** The JDBC type codes of this struct's attributes, in declaration order. */
protected static int[] _sqlType = { 2,2,2 };
+ /** The {@link ORADataFactory} for each struct-typed attribute, indexed by attribute position. */
protected static ORADataFactory[] _factory = new ORADataFactory[3];
+ /** The shared {@link ORADataFactory} instance for this class. */
protected static final OracleSdoPointType _OracleSdoPointTypeFactory = new OracleSdoPointType();
+ /**
+ * Returns the shared {@link ORADataFactory} for this class.
+ *
+ * @return the shared {@link ORADataFactory} for this class.
+ */
public static ORADataFactory getORADataFactory()
{ return _OracleSdoPointTypeFactory; }
/* constructors */
+ /**
+ * Initializes {@link #_struct} when requested.
+ *
+ * @param init {@code true} to (re)create {@link #_struct}.
+ */
protected void _init_struct(boolean init)
{ if (init) _struct = new MutableStruct(new Object[3], _sqlType, _factory); }
+ /**
+ * Default constructor.
+ */
public OracleSdoPointType()
{ _init_struct(true); }
+ /**
+ * Constructs a point with the given coordinate values.
+ *
+ * @param x the X attribute.
+ * @param y the Y attribute.
+ * @param z the Z attribute.
+ * @throws SQLException if setting an attribute fails.
+ */
public OracleSdoPointType(java.math.BigDecimal x, java.math.BigDecimal y, java.math.BigDecimal z) throws SQLException
{ _init_struct(true);
setX(x);
@@ -74,31 +101,76 @@ public Datum toDatum(Connection c) throws SQLException
/* ORADataFactory interface */
public ORAData create(Datum d, int sqlType) throws SQLException
{ return create(null, d, sqlType); }
+ /**
+ * Populates (or creates) an {@code OracleSdoPointType} from the given datum.
+ *
+ * @param o the instance to populate, or {@code null} to create a new one.
+ * @param d the source datum, or {@code null} to return {@code null}.
+ * @param sqlType the JDBC type code of the source datum.
+ * @return the populated instance, or {@code null} if {@code d} is {@code null}.
+ * @throws SQLException if reading the datum fails.
+ */
protected ORAData create(OracleSdoPointType o, Datum d, int sqlType) throws SQLException
{
- if (d == null) return null;
+ if (d == null) return null;
if (o == null) o = new OracleSdoPointType();
o._struct = new MutableStruct((STRUCT) d, _sqlType, _factory);
return o;
}
/* accessor methods */
+ /**
+ * Returns the X attribute.
+ *
+ * @return the X attribute.
+ * @throws SQLException if the underlying struct cannot be read.
+ */
public java.math.BigDecimal getX() throws SQLException
{ return (java.math.BigDecimal) _struct.getAttribute(0); }
+ /**
+ * Sets the X attribute.
+ *
+ * @param x the new X attribute value.
+ * @throws SQLException if the underlying struct cannot be written.
+ */
public void setX(java.math.BigDecimal x) throws SQLException
{ _struct.setAttribute(0, x); }
+ /**
+ * Returns the Y attribute.
+ *
+ * @return the Y attribute.
+ * @throws SQLException if the underlying struct cannot be read.
+ */
public java.math.BigDecimal getY() throws SQLException
{ return (java.math.BigDecimal) _struct.getAttribute(1); }
+ /**
+ * Sets the Y attribute.
+ *
+ * @param y the new Y attribute value.
+ * @throws SQLException if the underlying struct cannot be written.
+ */
public void setY(java.math.BigDecimal y) throws SQLException
{ _struct.setAttribute(1, y); }
+ /**
+ * Returns the Z attribute.
+ *
+ * @return the Z attribute.
+ * @throws SQLException if the underlying struct cannot be read.
+ */
public java.math.BigDecimal getZ() throws SQLException
{ return (java.math.BigDecimal) _struct.getAttribute(2); }
+ /**
+ * Sets the Z attribute.
+ *
+ * @param z the new Z attribute value.
+ * @throws SQLException if the underlying struct cannot be written.
+ */
public void setZ(java.math.BigDecimal z) throws SQLException
{ _struct.setAttribute(2, z); }
diff --git a/src/main/java/org/dbunit/ext/postgresql/CitextType.java b/src/main/java/org/dbunit/ext/postgresql/CitextType.java
index 62954d20d..84ddd07eb 100644
--- a/src/main/java/org/dbunit/ext/postgresql/CitextType.java
+++ b/src/main/java/org/dbunit/ext/postgresql/CitextType.java
@@ -50,6 +50,9 @@ public class CitextType
*/
private static final Logger logger = LoggerFactory.getLogger(CitextType.class);
+ /**
+ * Default constructor.
+ */
public CitextType() {
super("citext", Types.OTHER, String.class, false);
}
diff --git a/src/main/java/org/dbunit/ext/postgresql/GenericEnumType.java b/src/main/java/org/dbunit/ext/postgresql/GenericEnumType.java
index 03914c766..5fef29b2f 100644
--- a/src/main/java/org/dbunit/ext/postgresql/GenericEnumType.java
+++ b/src/main/java/org/dbunit/ext/postgresql/GenericEnumType.java
@@ -54,10 +54,12 @@ public class GenericEnumType extends AbstractDataType {
private final String sqlTypeName;
/**
+ * Creates a data type adapter for the given Postgres enum type.
+ *
* @param sqlTypeName The name of the enum type needed to invoke the "setType()" method on
* the PGObject class.
*/
- public GenericEnumType(String sqlTypeName)
+ public GenericEnumType(String sqlTypeName)
{
super(sqlTypeName, Types.OTHER, String.class, false);
diff --git a/src/main/java/org/dbunit/ext/postgresql/GeometryType.java b/src/main/java/org/dbunit/ext/postgresql/GeometryType.java
index 90665ef92..58278ffd8 100644
--- a/src/main/java/org/dbunit/ext/postgresql/GeometryType.java
+++ b/src/main/java/org/dbunit/ext/postgresql/GeometryType.java
@@ -11,7 +11,16 @@
import org.dbunit.dataset.datatype.AbstractDataType;
import org.dbunit.dataset.datatype.TypeCastException;
+/**
+ * Adapter to handle conversion between PostGIS
+ * native geometry type and Strings.
+ *
+ * @since 2.4.6
+ */
public class GeometryType extends AbstractDataType {
+ /**
+ * Default constructor.
+ */
public GeometryType() {
super("geometry", Types.OTHER, String.class, false);
}
diff --git a/src/main/java/org/dbunit/ext/postgresql/InetType.java b/src/main/java/org/dbunit/ext/postgresql/InetType.java
index 53dc08d0a..ab13733c6 100644
--- a/src/main/java/org/dbunit/ext/postgresql/InetType.java
+++ b/src/main/java/org/dbunit/ext/postgresql/InetType.java
@@ -48,6 +48,9 @@ public class InetType
*/
private static final Logger logger = LoggerFactory.getLogger(InetType.class);
+ /**
+ * Default constructor.
+ */
public InetType() {
super("inet", Types.OTHER, String.class, false);
}
diff --git a/src/main/java/org/dbunit/ext/postgresql/IntervalType.java b/src/main/java/org/dbunit/ext/postgresql/IntervalType.java
index 8f11d8952..3bc50eb6d 100644
--- a/src/main/java/org/dbunit/ext/postgresql/IntervalType.java
+++ b/src/main/java/org/dbunit/ext/postgresql/IntervalType.java
@@ -51,6 +51,9 @@ public class IntervalType extends AbstractDataType {
private static final Logger logger = LoggerFactory.getLogger(IntervalType.class);
+ /**
+ * Default constructor.
+ */
public IntervalType() {
super("interval", Types.OTHER, String.class, false);
}
diff --git a/src/main/java/org/dbunit/ext/postgresql/PostgreSQLOidDataType.java b/src/main/java/org/dbunit/ext/postgresql/PostgreSQLOidDataType.java
index 943d056bc..f8fbe4c60 100644
--- a/src/main/java/org/dbunit/ext/postgresql/PostgreSQLOidDataType.java
+++ b/src/main/java/org/dbunit/ext/postgresql/PostgreSQLOidDataType.java
@@ -16,6 +16,11 @@
import java.sql.Statement;
import java.sql.Types;
+/**
+ * {@link BytesDataType} specialization for PostgreSQL's oid large object columns.
+ *
+ * @since 2.7.0
+ */
public class PostgreSQLOidDataType
extends BytesDataType {
@@ -24,6 +29,9 @@ public class PostgreSQLOidDataType
*/
private static final Logger logger = LoggerFactory.getLogger(PostgreSQLOidDataType.class);
+ /**
+ * Default constructor.
+ */
public PostgreSQLOidDataType() {
super("OID", Types.BIGINT);
}
diff --git a/src/main/java/org/dbunit/ext/postgresql/PostgresqlDataTypeFactory.java b/src/main/java/org/dbunit/ext/postgresql/PostgresqlDataTypeFactory.java
index 662f75cc6..07f2d3b44 100644
--- a/src/main/java/org/dbunit/ext/postgresql/PostgresqlDataTypeFactory.java
+++ b/src/main/java/org/dbunit/ext/postgresql/PostgresqlDataTypeFactory.java
@@ -63,6 +63,11 @@ public Collection getValidDbProducts()
return DATABASE_PRODUCTS;
}
+ /**
+ * Returns the database product names supported by this factory.
+ *
+ * @return the database product names supported by this factory.
+ */
public static Collection getDatabaseProducts()
{
return DATABASE_PRODUCTS;
diff --git a/src/main/java/org/dbunit/ext/postgresql/UuidType.java b/src/main/java/org/dbunit/ext/postgresql/UuidType.java
index b5c7edc5e..e92d0c51f 100644
--- a/src/main/java/org/dbunit/ext/postgresql/UuidType.java
+++ b/src/main/java/org/dbunit/ext/postgresql/UuidType.java
@@ -50,6 +50,9 @@ public class UuidType
*/
private static final Logger logger = LoggerFactory.getLogger(UuidType.class);
+ /**
+ * Default constructor.
+ */
public UuidType() {
super("uuid", Types.OTHER, String.class, false);
}
diff --git a/src/main/java/org/dbunit/operation/AbstractOperation.java b/src/main/java/org/dbunit/operation/AbstractOperation.java
index 63e4c1167..90dddba62 100644
--- a/src/main/java/org/dbunit/operation/AbstractOperation.java
+++ b/src/main/java/org/dbunit/operation/AbstractOperation.java
@@ -51,6 +51,15 @@ public abstract class AbstractOperation extends DatabaseOperation
*/
private static final Logger logger = LoggerFactory.getLogger(AbstractOperation.class);
+ /**
+ * Qualifies the given table or column name with the given schema/catalog prefix,
+ * applying the connection's configured escape pattern.
+ *
+ * @param prefix the schema or catalog prefix.
+ * @param name the table or column name to qualify.
+ * @param connection the database connection providing the escape pattern configuration.
+ * @return the qualified name.
+ */
protected String getQualifiedName(String prefix, String name, IDatabaseConnection connection)
{
if (logger.isDebugEnabled())
diff --git a/src/main/java/org/dbunit/operation/CloseConnectionOperation.java b/src/main/java/org/dbunit/operation/CloseConnectionOperation.java
index 7134d4758..7e237bae0 100644
--- a/src/main/java/org/dbunit/operation/CloseConnectionOperation.java
+++ b/src/main/java/org/dbunit/operation/CloseConnectionOperation.java
@@ -50,6 +50,8 @@ public class CloseConnectionOperation extends DatabaseOperation
/**
* Creates a CloseConnectionOperation object that decorates the specified
* operation.
+ *
+ * @param operation the operation to decorate.
*/
public CloseConnectionOperation(DatabaseOperation operation)
{
diff --git a/src/main/java/org/dbunit/operation/CompositeOperation.java b/src/main/java/org/dbunit/operation/CompositeOperation.java
index cea4d5c6b..ee0381643 100644
--- a/src/main/java/org/dbunit/operation/CompositeOperation.java
+++ b/src/main/java/org/dbunit/operation/CompositeOperation.java
@@ -51,6 +51,9 @@ public class CompositeOperation extends DatabaseOperation
/**
* Creates a new composite operation combining the two specified operations.
+ *
+ * @param action1 the first operation to execute.
+ * @param action2 the second operation to execute.
*/
public CompositeOperation(DatabaseOperation action1, DatabaseOperation action2)
{
@@ -59,6 +62,8 @@ public CompositeOperation(DatabaseOperation action1, DatabaseOperation action2)
/**
* Creates a new composite operation combining the specified operations.
+ *
+ * @param actions the operations to execute, in order.
*/
public CompositeOperation(DatabaseOperation[] actions)
{
diff --git a/src/main/java/org/dbunit/operation/DatabaseOperation.java b/src/main/java/org/dbunit/operation/DatabaseOperation.java
index 7c887ce79..f2b1399b1 100644
--- a/src/main/java/org/dbunit/operation/DatabaseOperation.java
+++ b/src/main/java/org/dbunit/operation/DatabaseOperation.java
@@ -36,6 +36,7 @@
*/
public abstract class DatabaseOperation
{
+
/**
* No-op that does nothing to the database.
* @see DummyOperation
diff --git a/src/main/java/org/dbunit/operation/DeleteAllOperation.java b/src/main/java/org/dbunit/operation/DeleteAllOperation.java
index e7c54386b..91f331198 100644
--- a/src/main/java/org/dbunit/operation/DeleteAllOperation.java
+++ b/src/main/java/org/dbunit/operation/DeleteAllOperation.java
@@ -66,11 +66,24 @@ public class DeleteAllOperation extends AbstractOperation
{
}
+ /**
+ * Returns the SQL command prefix used to delete all rows of a table.
+ *
+ * @return the SQL command prefix used to delete all rows of a table.
+ */
protected String getDeleteAllCommand()
{
return "delete from ";
}
+ /**
+ * Returns a suffix appended to the delete-all SQL statement for the given connection.
+ * The default implementation returns an empty string.
+ *
+ * @param connection the database connection the statement will be executed on.
+ * @return the SQL statement suffix.
+ * @throws SQLException if determining the suffix requires a database access that fails.
+ */
protected String getDeleteAllCommandSuffix(IDatabaseConnection connection) throws SQLException
{
return "";
diff --git a/src/main/java/org/dbunit/operation/ExclusiveTransactionException.java b/src/main/java/org/dbunit/operation/ExclusiveTransactionException.java
index 60573ee49..e98bcd5bf 100644
--- a/src/main/java/org/dbunit/operation/ExclusiveTransactionException.java
+++ b/src/main/java/org/dbunit/operation/ExclusiveTransactionException.java
@@ -35,20 +35,43 @@ public class ExclusiveTransactionException extends DatabaseUnitException
{
private static final long serialVersionUID = 1L;
+ /**
+ * Constructs an ExclusiveTransactionException with no detail
+ * message and no encapsulated exception.
+ */
public ExclusiveTransactionException()
{
}
+ /**
+ * Constructs an ExclusiveTransactionException with the specified detail
+ * message and no encapsulated exception.
+ *
+ * @param msg the detail message.
+ */
public ExclusiveTransactionException(String msg)
{
super(msg);
}
+ /**
+ * Constructs an ExclusiveTransactionException with the specified detail
+ * message and encapsulated exception.
+ *
+ * @param msg the detail message.
+ * @param e the encapsulated exception.
+ */
public ExclusiveTransactionException(String msg, Throwable e)
{
super(msg, e);
}
+ /**
+ * Constructs an ExclusiveTransactionException with the encapsulated
+ * exception and use its message as detail message.
+ *
+ * @param e the encapsulated exception.
+ */
public ExclusiveTransactionException(Throwable e)
{
super(e);
diff --git a/src/main/java/org/dbunit/operation/OperationData.java b/src/main/java/org/dbunit/operation/OperationData.java
index 6010da5ea..7c046dc6d 100644
--- a/src/main/java/org/dbunit/operation/OperationData.java
+++ b/src/main/java/org/dbunit/operation/OperationData.java
@@ -39,8 +39,10 @@ public class OperationData
private final Column[] _columns;
/**
- * @param sql
- * @param columns
+ * Constructs an OperationData pairing the given SQL statement with its bound columns.
+ *
+ * @param sql the SQL statement.
+ * @param columns the columns whose values are bound as the statement's parameters.
*/
public OperationData(String sql, Column[] columns)
{
@@ -48,11 +50,21 @@ public OperationData(String sql, Column[] columns)
_columns = columns;
}
+ /**
+ * Returns the SQL statement.
+ *
+ * @return the SQL statement.
+ */
public String getSql()
{
return _sql;
}
+ /**
+ * Returns the columns whose values are bound as the statement's parameters.
+ *
+ * @return the columns whose values are bound as the statement's parameters.
+ */
public Column[] getColumns()
{
return _columns;
diff --git a/src/main/java/org/dbunit/operation/TransactionOperation.java b/src/main/java/org/dbunit/operation/TransactionOperation.java
index f7dda7702..89ac3de45 100644
--- a/src/main/java/org/dbunit/operation/TransactionOperation.java
+++ b/src/main/java/org/dbunit/operation/TransactionOperation.java
@@ -49,6 +49,8 @@ public class TransactionOperation extends DatabaseOperation
/**
* Creates a TransactionOperation that decorates the specified operation.
+ *
+ * @param operation the operation to decorate.
*/
public TransactionOperation(DatabaseOperation operation)
{
diff --git a/src/main/java/org/dbunit/util/Base64.java b/src/main/java/org/dbunit/util/Base64.java
index 9059ec492..8d43a08d0 100644
--- a/src/main/java/org/dbunit/util/Base64.java
+++ b/src/main/java/org/dbunit/util/Base64.java
@@ -132,7 +132,10 @@ private Base64()
}
- /** Testing. */
+ /**
+ * Testing.
+ * @param args command-line arguments (unused).
+ */
public static void main(String[] args)
{
logger.debug("main(args=" + args + ") - start");
@@ -349,6 +352,7 @@ public static String encodeObject(java.io.Serializable serializableObject)
* encodeBytes( source, 0, source.length )
*
* @param source The data to convert
+ * @return the Base64-encoded string.
* @since 1.4
*/
public static String encodeBytes(byte[] source)
@@ -366,6 +370,7 @@ public static String encodeBytes(byte[] source)
* @param source The data to convert
* @param off Offset in array where conversion should begin
* @param len Length of data to convert
+ * @return the Base64-encoded string.
* @since 1.4
*/
public static String encodeBytes(byte[] source, int off, int len)
diff --git a/src/main/java/org/dbunit/util/FileHelper.java b/src/main/java/org/dbunit/util/FileHelper.java
index 08ec1024f..16352dc55 100644
--- a/src/main/java/org/dbunit/util/FileHelper.java
+++ b/src/main/java/org/dbunit/util/FileHelper.java
@@ -98,6 +98,13 @@ public static boolean deleteDirectory(File directory)
return success;
}
+ /**
+ * Creates an {@link InputSource} for the given file.
+ *
+ * @param file the file to create an {@link InputSource} for.
+ * @return the input source for the given file.
+ * @throws MalformedURLException if the file's path cannot be converted to a URL.
+ */
public static InputSource createInputSource(File file) throws MalformedURLException
{
String uri = file/*.getAbsoluteFile()*/.toURI().toURL().toString();
@@ -111,7 +118,7 @@ public static InputSource createInputSource(File file) throws MalformedURLExcept
*
* @param srcFile the src file
* @param destFile the dest file
- * @throws IOException
+ * @throws IOException if copying the file fails.
*/
public static void copyFile(File srcFile, File destFile) throws IOException
{
@@ -134,7 +141,7 @@ public static void copyFile(File srcFile, File destFile) throws IOException
*
* @param theFile the file to be read
* @return a list of Strings, each one representing one line from the given file
- * @throws IOException
+ * @throws IOException if the file cannot be read.
*/
public static List readLines(File theFile) throws IOException
{
diff --git a/src/main/java/org/dbunit/util/QualifiedTableName.java b/src/main/java/org/dbunit/util/QualifiedTableName.java
index f447ca5e4..28ef68e05 100644
--- a/src/main/java/org/dbunit/util/QualifiedTableName.java
+++ b/src/main/java/org/dbunit/util/QualifiedTableName.java
@@ -105,6 +105,8 @@ private void parseFullTableName(String fullTableName, String defaultSchema)
}
/**
+ * Returns the schema name given in the constructor, if any.
+ *
* @return The schema name which can be null if no schema has been given in the constructor
*/
public String getSchema() {
@@ -112,6 +114,8 @@ public String getSchema() {
}
/**
+ * Returns the plain, unqualified table name.
+ *
* @return The name of the plain, unqualified table
*/
public String getTable() {
@@ -119,9 +123,11 @@ public String getTable() {
}
/**
+ * Returns the table name qualified with its schema, if any.
+ *
* @return The qualified table name with the prepended schema if a schema is available
*/
- public String getQualifiedName()
+ public String getQualifiedName()
{
logger.debug("getQualifiedName() - start");
@@ -133,6 +139,7 @@ public String getQualifiedName()
* The qualified table name is only returned if the feature
* {@link DatabaseConfig#FEATURE_QUALIFIED_TABLE_NAMES} is set. Otherwise the given
* name is returned unqualified (i.e. without prepending the prefix/schema).
+ * @param config the configuration providing the {@link DatabaseConfig#FEATURE_QUALIFIED_TABLE_NAMES} feature flag.
* @return The qualified table name with the prepended schema if a schema is available.
* The qualified table name is only returned if the feature
* {@link DatabaseConfig#FEATURE_QUALIFIED_TABLE_NAMES} is set in the given config.
diff --git a/src/main/java/org/dbunit/util/RelativeDateTimeParser.java b/src/main/java/org/dbunit/util/RelativeDateTimeParser.java
index 7af6e7a75..f2d92f694 100644
--- a/src/main/java/org/dbunit/util/RelativeDateTimeParser.java
+++ b/src/main/java/org/dbunit/util/RelativeDateTimeParser.java
@@ -76,18 +76,32 @@ public class RelativeDateTimeParser
private Clock clock;
private LocalDateTime now;
+ /**
+ * Default constructor.
+ */
public RelativeDateTimeParser()
{
// Use fixed clock to provide consistent 'now' values.
this(Clock.fixed(Instant.now(), ZoneId.systemDefault()));
}
+ /**
+ * Constructs a parser resolving [now] relative to the given clock.
+ *
+ * @param clock the clock used to resolve [now].
+ */
public RelativeDateTimeParser(Clock clock)
{
this.clock = clock;
cacheLocalDateTime(clock);
}
+ /**
+ * Parses a relative datetime expression such as [now-1d].
+ *
+ * @param input the relative datetime expression to parse.
+ * @return the resolved date and time.
+ */
public LocalDateTime parse(String input)
{
if (input == null || input.isEmpty())
@@ -125,11 +139,21 @@ public LocalDateTime parse(String input)
return datetime;
}
+ /**
+ * Returns the clock used to resolve [now].
+ *
+ * @return the clock used to resolve [now].
+ */
public Clock getClock()
{
return clock;
}
+ /**
+ * Sets the clock used to resolve [now].
+ *
+ * @param clock the clock used to resolve [now].
+ */
public void setClock(Clock clock)
{
this.clock = clock;
diff --git a/src/main/java/org/dbunit/util/SQLHelper.java b/src/main/java/org/dbunit/util/SQLHelper.java
index bb6b9f3e0..d94290104 100644
--- a/src/main/java/org/dbunit/util/SQLHelper.java
+++ b/src/main/java/org/dbunit/util/SQLHelper.java
@@ -115,8 +115,8 @@ public static void close(Statement stmt) throws SQLException {
/**
* Closes the given result set in a null-safe way
- * @param resultSet
- * @throws SQLException
+ * @param resultSet the result set to close, may be null.
+ * @throws SQLException if closing the result set fails.
*/
public static void close(ResultSet resultSet) throws SQLException {
logger.debug("close(resultSet={}) - start", resultSet);
@@ -131,7 +131,7 @@ public static void close(ResultSet resultSet) throws SQLException {
* @param connection The connection to a database
* @param schema The schema to be searched
* @return Returns true if the given schema exists for the given connection.
- * @throws SQLException
+ * @throws SQLException if a database access error occurs.
* @since 2.3.0
*/
public static boolean schemaExists(Connection connection, String schema)
@@ -218,7 +218,7 @@ private static boolean catalogExists(Connection connection, String catalog) thro
* @param tableName The table name to be searched
* @return Returns true if the given table exists in the given schema.
* Else returns false.
- * @throws SQLException
+ * @throws SQLException if a database access error occurs.
* @since 2.3.0
* @deprecated since 2.4.5 - use {@link IMetadataHandler#tableExists(DatabaseMetaData, String, String)}
*/
@@ -239,9 +239,9 @@ public static boolean tableExists(DatabaseMetaData metaData, String schema,
/**
* Utility method for debugging to print all tables of the given metadata on the given stream
- * @param metaData
- * @param outputStream
- * @throws SQLException
+ * @param metaData the database metadata to print the tables of.
+ * @param outputStream the stream to print to.
+ * @throws SQLException if a database access error occurs.
*/
public static void printAllTables(DatabaseMetaData metaData, PrintStream outputStream) throws SQLException
{
@@ -344,7 +344,7 @@ public String wrappedCall(DatabaseMetaData metaData) throws Exception {
* Prints the database and JDBC driver information to the given output stream
* @param metaData The JDBC database metadata needed to retrieve database information
* @param outputStream The stream to which the information is printed
- * @throws SQLException
+ * @throws SQLException if a database access error occurs.
*/
public static void printDatabaseInfo(DatabaseMetaData metaData, PrintStream outputStream) throws SQLException
{
@@ -362,7 +362,7 @@ public static void printDatabaseInfo(DatabaseMetaData metaData, PrintStream outp
* or not.
* @param metaData The metadata to be checked whether it is a Sybase connection
* @return true if and only if the given metadata belongs to a Sybase database.
- * @throws SQLException
+ * @throws SQLException if a database access error occurs.
*/
public static boolean isSybaseDb(DatabaseMetaData metaData) throws SQLException
{
@@ -381,8 +381,8 @@ public static boolean isSybaseDb(DatabaseMetaData metaData) throws SQLException
* be created because of an unknown datatype.
* @return The {@link Column} or null if the column could not be initialized because of an
* unknown datatype.
- * @throws SQLException
- * @throws DataTypeException
+ * @throws SQLException if a database access error occurs.
+ * @throws DataTypeException if the column's data type cannot be determined.
* @since 2.4.0
*/
public static final Column createColumn(ResultSet resultSet,
@@ -440,7 +440,7 @@ public static final Column createColumn(ResultSet resultSet,
* @param caseSensitive Whether or not the comparison should be case sensitive or not
* @return true if the column metadata of the given resultSet matches
* the given schema and table parameters.
- * @throws SQLException
+ * @throws SQLException if a database access error occurs.
* @since 2.4.0
* @deprecated since 2.4.4 - use {@link IMetadataHandler#matches(ResultSet, String, String, String, String, boolean)}
*/
@@ -463,7 +463,7 @@ public static boolean matches(ResultSet resultSet,
* @param caseSensitive Whether or not the comparison should be case sensitive or not
* @return true if the column metadata of the given resultSet matches
* the given schema and table parameters.
- * @throws SQLException
+ * @throws SQLException if a database access error occurs.
* @since 2.4.0
* @deprecated since 2.4.4 - use {@link IMetadataHandler#matches(ResultSet, String, String, String, String, boolean)}
*/
@@ -499,6 +499,7 @@ public static boolean matches(ResultSet resultSet,
* for this specific case.
* @param value1 The first value to compare. Is ignored if null or empty String
* @param value2 The second value to be compared
+ * @param caseSensitive Whether or not the comparison should be case sensitive.
* @return true if both values are equal or if the first value
* is null or empty string.
* @since 2.4.4
diff --git a/src/main/java/org/dbunit/util/TableFormatter.java b/src/main/java/org/dbunit/util/TableFormatter.java
index 7a570bc83..f6dc2d7fa 100644
--- a/src/main/java/org/dbunit/util/TableFormatter.java
+++ b/src/main/java/org/dbunit/util/TableFormatter.java
@@ -37,6 +37,9 @@
public class TableFormatter
{
+ /**
+ * Default constructor.
+ */
public TableFormatter()
{
@@ -47,9 +50,9 @@ public TableFormatter()
* given
* length.
*
- * @param s
- * @param length
- * @param padChar
+ * @param s the string to pad.
+ * @param length the desired length of the resulting string.
+ * @param padChar the character to pad with.
* @return The padded string
*/
public static final String padLeft(String s, int length, char padChar)
@@ -67,9 +70,9 @@ public static final String padLeft(String s, int length, char padChar)
* Pads the given String with the given padChar up to the given
* length.
*
- * @param s
- * @param length
- * @param padChar
+ * @param s the string to pad.
+ * @param length the desired length of the resulting string.
+ * @param padChar the character to pad with.
* @return The padded string
*/
public static final String padRight(String s, int length, char padChar)
@@ -121,7 +124,7 @@ private static final String pad(String s, char[] padArray, boolean padLeft)
* @param table
* The table to be formatted in a beautiful way
* @return The table data as a formatted String
- * @throws DataSetException
+ * @throws DataSetException if the table data cannot be read.
*/
public String format(ITable table) throws DataSetException
{
diff --git a/src/main/java/org/dbunit/util/concurrent/BoundedBuffer.java b/src/main/java/org/dbunit/util/concurrent/BoundedBuffer.java
index 27fe665b6..e31c1b1c0 100644
--- a/src/main/java/org/dbunit/util/concurrent/BoundedBuffer.java
+++ b/src/main/java/org/dbunit/util/concurrent/BoundedBuffer.java
@@ -36,12 +36,17 @@ public class BoundedBuffer implements BoundedChannel {
*/
private static final Logger logger = LoggerFactory.getLogger(BoundedBuffer.class);
+ /** The elements. */
protected final Object[] array_; // the elements
+ /** Circular index of the next element to take. */
protected int takePtr_ = 0; // circular indices
- protected int putPtr_ = 0;
+ /** Circular index of the next slot to put into. */
+ protected int putPtr_ = 0;
+ /** Number of occupied slots (the buffer's length). */
protected int usedSlots_ = 0; // length
+ /** Number of free slots (capacity - length). */
protected int emptySlots_; // capacity - length
/**
@@ -51,6 +56,7 @@ public class BoundedBuffer implements BoundedChannel {
/**
* Create a BoundedBuffer with the given capacity.
+ * @param capacity the maximum number of elements the buffer can hold.
* @exception IllegalArgumentException if capacity less or equal to zero
**/
public BoundedBuffer(int capacity) throws IllegalArgumentException {
@@ -67,10 +73,11 @@ public BoundedBuffer() {
this(DefaultChannelCapacity.get());
}
- /**
+ /**
* Return the number of elements in the buffer.
* This is only a snapshot value, that may change
* immediately after returning.
+ * @return the number of elements in the buffer.
**/
public synchronized int size() {
return usedSlots_;
@@ -80,6 +87,7 @@ public int capacity() {
return array_.length;
}
+ /** Increments the empty-slot count and wakes a thread waiting to put. */
protected void incEmptySlots() {
synchronized(putMonitor_) {
++emptySlots_;
@@ -87,11 +95,16 @@ protected void incEmptySlots() {
}
}
+ /** Increments the used-slot count and wakes a thread waiting to take. */
protected synchronized void incUsedSlots() {
++usedSlots_;
notify();
}
+ /**
+ * Inserts the given element into the buffer at putPtr_.
+ * @param x the element to insert.
+ */
protected final void insert(Object x) {
logger.debug("insert(x={}) - start", x);
// mechanics of put
@@ -100,6 +113,10 @@ protected final void insert(Object x) {
if (++putPtr_ >= array_.length) putPtr_ = 0;
}
+ /**
+ * Removes and returns the element at takePtr_.
+ * @return the removed element.
+ */
protected final Object extract() {
logger.debug("extract() - start");
// mechanics of take
diff --git a/src/main/java/org/dbunit/util/concurrent/BoundedLinkedQueue.java b/src/main/java/org/dbunit/util/concurrent/BoundedLinkedQueue.java
index f8a460def..86676a8b1 100644
--- a/src/main/java/org/dbunit/util/concurrent/BoundedLinkedQueue.java
+++ b/src/main/java/org/dbunit/util/concurrent/BoundedLinkedQueue.java
@@ -118,6 +118,7 @@ public class BoundedLinkedQueue implements BoundedChannel {
/**
* Create a queue with the given capacity
+ * @param capacity the maximum number of elements the queue can hold.
* @exception IllegalArgumentException if capacity less or equal to zero
**/
public BoundedLinkedQueue(int capacity) {
@@ -137,9 +138,10 @@ public BoundedLinkedQueue() {
}
/**
- * Move put permits from take side to put side;
+ * Move put permits from take side to put side;
* return the number of put side permits that are available.
* Call only under synch on puGuard_ AND this.
+ * @return the number of put side permits that are available.
**/
protected final int reconcilePutPermits() {
logger.debug("reconcilePutPermits() - start");
@@ -162,6 +164,7 @@ public synchronized int capacity() {
* of changing. The returned value will be unreliable in the presence of
* active puts and takes, and should only be used as a heuristic
* estimate, for example for resource monitoring purposes.
+ * @return the number of elements in the queue.
**/
public synchronized int size() {
logger.debug("size() - start");
@@ -182,6 +185,7 @@ public synchronized int size() {
* existing elements are NOT removed, but
* incoming puts will not proceed until the number of elements
* is less than the new capacity.
+ * @param newCapacity the new capacity.
* @exception IllegalArgumentException if capacity less or equal to zero
**/
@@ -202,7 +206,10 @@ public void setCapacity(int newCapacity) {
}
- /** Main mechanics for take/poll **/
+ /**
+ * Main mechanics for take/poll
+ * @return the removed element, or null if the queue is empty.
+ **/
protected synchronized Object extract() {
logger.debug("extract() - start");
@@ -304,6 +311,7 @@ protected final void allowTake() {
/**
* Create and insert a node.
* Call only under synch on putGuard_
+ * @param x the element to insert.
**/
protected void insert(Object x) {
logger.debug("insert(x=" + x + ") - start");
@@ -400,6 +408,10 @@ public boolean offer(Object x, long msecs) throws InterruptedException {
return true;
}
+ /**
+ * Returns whether the queue currently has no elements.
+ * @return true if the queue currently has no elements.
+ */
public boolean isEmpty() {
logger.debug("isEmpty() - start");
diff --git a/src/main/java/org/dbunit/util/concurrent/Channel.java b/src/main/java/org/dbunit/util/concurrent/Channel.java
index 7e06c38e5..52d15d6e3 100644
--- a/src/main/java/org/dbunit/util/concurrent/Channel.java
+++ b/src/main/java/org/dbunit/util/concurrent/Channel.java
@@ -301,6 +301,7 @@ public interface Channel extends Puttable, Takable {
/**
* Return, but do not remove object at head of Channel,
* or null if it is empty.
+ * @return the object at the head of the channel, or null if it is empty.
**/
public Object peek();
diff --git a/src/main/java/org/dbunit/util/concurrent/DefaultChannelCapacity.java b/src/main/java/org/dbunit/util/concurrent/DefaultChannelCapacity.java
index aeb46886c..8ae181682 100644
--- a/src/main/java/org/dbunit/util/concurrent/DefaultChannelCapacity.java
+++ b/src/main/java/org/dbunit/util/concurrent/DefaultChannelCapacity.java
@@ -46,6 +46,7 @@ public class DefaultChannelCapacity {
* Set the default capacity used in
* default (no-argument) constructor for BoundedChannels
* that otherwise require a capacity argument.
+ * @param capacity the new default capacity.
* @exception IllegalArgumentException if capacity less or equal to zero
*/
public static void set(int capacity) {
@@ -60,6 +61,7 @@ public static void set(int capacity) {
* that otherwise require a capacity argument.
* Initial value is INITIAL_DEFAULT_CAPACITY
* @see #INITIAL_DEFAULT_CAPACITY
+ * @return the current default capacity.
*/
public static int get() {
return defaultCapacity_.get();
diff --git a/src/main/java/org/dbunit/util/concurrent/Executor.java b/src/main/java/org/dbunit/util/concurrent/Executor.java
index 788036e82..874c95d7b 100644
--- a/src/main/java/org/dbunit/util/concurrent/Executor.java
+++ b/src/main/java/org/dbunit/util/concurrent/Executor.java
@@ -64,6 +64,9 @@ public interface Executor {
* Further, the general contract of the method is to avoid,
* suppress, or abort execution if interruption is detected
* in any controllable context surrounding execution.
+ * @param command the command to execute.
+ * @throws InterruptedException if the current thread is interrupted before execution
+ * could be arranged.
**/
public void execute(Runnable command) throws InterruptedException;
diff --git a/src/main/java/org/dbunit/util/concurrent/LinkedNode.java b/src/main/java/org/dbunit/util/concurrent/LinkedNode.java
index 1ecc4cc8f..02e66b9f0 100644
--- a/src/main/java/org/dbunit/util/concurrent/LinkedNode.java
+++ b/src/main/java/org/dbunit/util/concurrent/LinkedNode.java
@@ -23,10 +23,29 @@
* @version $Revision$ $Date$
* @since ? (pre 2.1)
*/
-public class LinkedNode {
+public class LinkedNode {
+ /** The value held by this node. */
public Object value;
+ /** The next node in the list, or {@code null} if this is the last node. */
public LinkedNode next;
+
+ /**
+ * Default constructor.
+ */
public LinkedNode() {}
+
+ /**
+ * Constructs a node holding the given value.
+ *
+ * @param x the value held by this node.
+ */
public LinkedNode(Object x) { value = x; }
+
+ /**
+ * Constructs a node holding the given value and linked to the given next node.
+ *
+ * @param x the value held by this node.
+ * @param n the next node in the list.
+ */
public LinkedNode(Object x, LinkedNode n) { value = x; next = n; }
}
diff --git a/src/main/java/org/dbunit/util/concurrent/LinkedQueue.java b/src/main/java/org/dbunit/util/concurrent/LinkedQueue.java
index 1d32060c4..6bfe2c9af 100644
--- a/src/main/java/org/dbunit/util/concurrent/LinkedQueue.java
+++ b/src/main/java/org/dbunit/util/concurrent/LinkedQueue.java
@@ -69,15 +69,22 @@ public class LinkedQueue implements Channel {
**/
protected int waitingForTake_ = 0;
+ /**
+ * Default constructor.
+ */
public LinkedQueue() {
- head_ = new LinkedNode(null);
+ head_ = new LinkedNode(null);
last_ = head_;
}
- /** Main mechanics for put/offer **/
+ /**
+ * Main mechanics for put/offer.
+ *
+ * @param x the value to insert.
+ **/
protected void insert(Object x) {
logger.debug("insert(x=" + x + ") - start");
-
+
synchronized(putLock_) {
LinkedNode p = new LinkedNode(x);
synchronized(last_) {
@@ -89,7 +96,11 @@ protected void insert(Object x) {
}
}
- /** Main mechanics for take/poll **/
+ /**
+ * Main mechanics for take/poll.
+ *
+ * @return the extracted value, or {@code null} if the queue is empty.
+ **/
protected synchronized Object extract() {
logger.debug("extract() - start");
@@ -168,6 +179,11 @@ public Object peek() {
}
+ /**
+ * Returns whether the queue is empty.
+ *
+ * @return {@code true} if the queue is empty, {@code false} otherwise.
+ */
public boolean isEmpty() {
logger.debug("isEmpty() - start");
diff --git a/src/main/java/org/dbunit/util/concurrent/PropertyChangeMulticaster.java b/src/main/java/org/dbunit/util/concurrent/PropertyChangeMulticaster.java
index d2df630d8..49c9be263 100644
--- a/src/main/java/org/dbunit/util/concurrent/PropertyChangeMulticaster.java
+++ b/src/main/java/org/dbunit/util/concurrent/PropertyChangeMulticaster.java
@@ -110,6 +110,9 @@ public class PropertyChangeMulticaster implements Serializable {
/**
* Return the child associated with property, or null if no such
+ *
+ * @param propertyName the property name.
+ * @return the child multicaster associated with the property, or {@code null} if none.
**/
protected synchronized PropertyChangeMulticaster getChild(String propertyName) {
@@ -314,8 +317,10 @@ public void removePropertyChangeListener(String propertyName,
/**
- * Helper method to relay evt to all listeners.
+ * Helper method to relay evt to all listeners.
* Called by all public firePropertyChange methods.
+ *
+ * @param evt the event to relay to all listeners.
**/
protected void multicast(PropertyChangeEvent evt) {
@@ -466,6 +471,10 @@ else if (propertyName == null || children == null)
/**
+ * Serializes this instance, writing only the serializable listeners.
+ *
+ * @param s the stream to write to.
+ * @throws IOException if writing to the stream fails.
* @serialData Null terminated list of PropertyChangeListeners.
*
* At serialization time we skip non-serializable listeners and
@@ -476,16 +485,23 @@ private synchronized void writeObject(ObjectOutputStream s) throws IOException {
logger.debug("writeObject(s={}) - start", s);
s.defaultWriteObject();
-
- for (int i = 0; i < listeners.length; i++) {
+
+ for (int i = 0; i < listeners.length; i++) {
if (listeners[i] instanceof Serializable) {
s.writeObject(listeners[i]);
}
}
s.writeObject(null);
}
-
-
+
+
+ /**
+ * Deserializes this instance, restoring the listeners written by {@link #writeObject(ObjectOutputStream)}.
+ *
+ * @param s the stream to read from.
+ * @throws ClassNotFoundException if a serialized listener's class cannot be found.
+ * @throws IOException if reading from the stream fails.
+ */
private void readObject(ObjectInputStream s) throws ClassNotFoundException, IOException {
logger.debug("readObject(s={}) - start", s);
diff --git a/src/main/java/org/dbunit/util/concurrent/Semaphore.java b/src/main/java/org/dbunit/util/concurrent/Semaphore.java
index b7d0d139b..64c23d67d 100644
--- a/src/main/java/org/dbunit/util/concurrent/Semaphore.java
+++ b/src/main/java/org/dbunit/util/concurrent/Semaphore.java
@@ -108,6 +108,8 @@ public class Semaphore implements Sync {
* Using a seed of one makes the semaphore act as a mutual exclusion lock.
* Negative seeds are also allowed, in which case no acquires will proceed
* until the number of releases has pushed the number of permits past 0.
+ *
+ * @param initialPermits the initial number of permits.
**/
public Semaphore(long initialPermits) { permits_ = initialPermits; }
@@ -185,6 +187,7 @@ public synchronized void release() {
*
*
* But may be more efficient in some semaphore implementations.
+ * @param n the number of permits to release.
* @exception IllegalArgumentException if n is negative.
**/
public synchronized void release(long n) {
@@ -200,6 +203,8 @@ public synchronized void release(long n) {
* Return the current number of available permits.
* Returns an accurate, but possibly unstable value,
* that may change immediately after returning.
+ *
+ * @return the current number of available permits.
**/
public synchronized long permits() {
return permits_;
diff --git a/src/main/java/org/dbunit/util/concurrent/SemaphoreControlledChannel.java b/src/main/java/org/dbunit/util/concurrent/SemaphoreControlledChannel.java
index f650ef08b..12730ebdf 100644
--- a/src/main/java/org/dbunit/util/concurrent/SemaphoreControlledChannel.java
+++ b/src/main/java/org/dbunit/util/concurrent/SemaphoreControlledChannel.java
@@ -38,17 +38,21 @@ public abstract class SemaphoreControlledChannel implements BoundedChannel {
*/
private static final Logger logger = LoggerFactory.getLogger(SemaphoreControlledChannel.class);
+ /** Guards puts, holding one permit per free slot. */
protected final Semaphore putGuard_;
+ /** Guards takes, holding one permit per filled slot. */
protected final Semaphore takeGuard_;
+ /** The channel's fixed capacity. */
protected int capacity_;
/**
* Create a channel with the given capacity and default
* semaphore implementation
+ * @param capacity the channel's fixed capacity.
* @exception IllegalArgumentException if capacity less or equal to zero
**/
- public SemaphoreControlledChannel(int capacity)
+ public SemaphoreControlledChannel(int capacity)
throws IllegalArgumentException {
if (capacity <= 0) throw new IllegalArgumentException();
capacity_ = capacity;
@@ -58,8 +62,10 @@ public SemaphoreControlledChannel(int capacity)
/**
- * Create a channel with the given capacity and
+ * Create a channel with the given capacity and
* semaphore implementations instantiated from the supplied class
+ * @param capacity the channel's fixed capacity.
+ * @param semaphoreClass the {@link Semaphore} subclass to instantiate for the put/take guards.
* @exception IllegalArgumentException if capacity less or equal to zero.
* @exception NoSuchMethodException If class does not have constructor
* that intializes permits
@@ -91,10 +97,12 @@ public int capacity() {
logger.debug("capacity() - start");
return capacity_; }
- /**
+ /**
* Return the number of elements in the buffer.
* This is only a snapshot value, that may change
* immediately after returning.
+ *
+ * @return the number of elements in the buffer.
**/
public int size() {
@@ -103,11 +111,15 @@ public int size() {
/**
* Internal mechanics of put.
+ *
+ * @param x the value to insert.
**/
protected abstract void insert(Object x);
/**
* Internal mechanics of take.
+ *
+ * @return the extracted value.
**/
protected abstract Object extract();
diff --git a/src/main/java/org/dbunit/util/concurrent/Slot.java b/src/main/java/org/dbunit/util/concurrent/Slot.java
index f7b6aba89..b72298971 100644
--- a/src/main/java/org/dbunit/util/concurrent/Slot.java
+++ b/src/main/java/org/dbunit/util/concurrent/Slot.java
@@ -46,7 +46,8 @@ public class Slot extends SemaphoreControlledChannel {
/**
* Create a buffer with the given capacity, using
* the supplied Semaphore class for semaphores.
- * @exception NoSuchMethodException If class does not have constructor
+ * @param semaphoreClass the {@link Semaphore} subclass to instantiate for the put/take guards.
+ * @exception NoSuchMethodException If class does not have constructor
* that intializes permits
* @exception SecurityException if constructor information
* not accessible
diff --git a/src/main/java/org/dbunit/util/concurrent/Sync.java b/src/main/java/org/dbunit/util/concurrent/Sync.java
index 0c5121a2e..fcc1d1232 100644
--- a/src/main/java/org/dbunit/util/concurrent/Sync.java
+++ b/src/main/java/org/dbunit/util/concurrent/Sync.java
@@ -268,6 +268,8 @@ public interface Sync {
* been acquired, and that no
* corresponding release should be performed. Conversely,
* a normal return guarantees that the acquire was successful.
+ *
+ * @throws InterruptedException if interrupted while waiting.
**/
public void acquire() throws InterruptedException;
@@ -287,13 +289,14 @@ public interface Sync {
* will return at all without blocking indefinitely when used in
* unintended ways. For example, deadlocks may be encountered
* when called in an unintended context.
- *
+ *
* @param msecs the number of milleseconds to wait.
- * An argument less than or equal to zero means not to wait at all.
+ * An argument less than or equal to zero means not to wait at all.
* However, this may still require
* access to a synchronization lock, which can impose unbounded
* delay if there is a lot of contention among threads.
* @return true if acquired
+ * @throws InterruptedException if interrupted while waiting.
**/
public boolean attempt(long msecs) throws InterruptedException;
diff --git a/src/main/java/org/dbunit/util/concurrent/SynchronizedInt.java b/src/main/java/org/dbunit/util/concurrent/SynchronizedInt.java
index fff779af4..3845ce0c0 100644
--- a/src/main/java/org/dbunit/util/concurrent/SynchronizedInt.java
+++ b/src/main/java/org/dbunit/util/concurrent/SynchronizedInt.java
@@ -33,35 +33,44 @@ public class SynchronizedInt extends SynchronizedVariable implements Comparable,
*/
private static final Logger logger = LoggerFactory.getLogger(SynchronizedInt.class);
+ /** The current value. */
protected int value_;
- /**
+ /**
* Make a new SynchronizedInt with the given initial value,
* and using its own internal lock.
+ *
+ * @param initialValue the initial value.
**/
- public SynchronizedInt(int initialValue) {
- super();
- value_ = initialValue;
+ public SynchronizedInt(int initialValue) {
+ super();
+ value_ = initialValue;
}
- /**
+ /**
* Make a new SynchronizedInt with the given initial value,
* and using the supplied lock.
+ *
+ * @param initialValue the initial value.
+ * @param lock the synchronization lock to use.
**/
- public SynchronizedInt(int initialValue, Object lock) {
- super(lock);
- value_ = initialValue;
+ public SynchronizedInt(int initialValue, Object lock) {
+ super(lock);
+ value_ = initialValue;
}
- /**
- * Return the current value
+ /**
+ * Return the current value
+ *
+ * @return the current value.
**/
public final int get() {
synchronized(lock_) { return value_; } }
- /**
+ /**
* Set to newValue.
- * @return the old value
+ * @param newValue the new value.
+ * @return the old value
**/
public int set(int newValue) {
@@ -76,6 +85,8 @@ public int set(int newValue) {
/**
* Set value to newValue only if it is currently assumedValue.
+ * @param assumedValue the value the current value must equal for the update to happen.
+ * @param newValue the new value.
* @return true if successful
**/
public boolean commit(int assumedValue, int newValue) {
@@ -95,7 +106,8 @@ public boolean commit(int assumedValue, int newValue) {
* (Note: Ordering via identyHashCode is not strictly guaranteed
* by the language specification to return unique, orderable
* values, but in practice JVMs rely on them being unique.)
- * @return the new value
+ * @param other the SynchronizedInt to swap values with.
+ * @return the new value
**/
public int swap(SynchronizedInt other) {
@@ -138,7 +150,8 @@ public int decrement() {
/**
* Add amount to value (i.e., set value += amount)
- * @return the new value
+ * @param amount the amount to add.
+ * @return the new value
**/
public int add(int amount) {
synchronized (lock_) {
@@ -148,7 +161,8 @@ public int add(int amount) {
/**
* Subtract amount from value (i.e., set value -= amount)
- * @return the new value
+ * @param amount the amount to subtract.
+ * @return the new value
**/
public int subtract(int amount) {
synchronized (lock_) {
@@ -158,7 +172,8 @@ public int subtract(int amount) {
/**
* Multiply value by factor (i.e., set value *= factor)
- * @return the new value
+ * @param factor the factor to multiply by.
+ * @return the new value
**/
public synchronized int multiply(int factor) {
synchronized (lock_) {
@@ -168,7 +183,8 @@ public synchronized int multiply(int factor) {
/**
* Divide value by factor (i.e., set value /= factor)
- * @return the new value
+ * @param factor the factor to divide by.
+ * @return the new value
**/
public int divide(int factor) {
synchronized (lock_) {
@@ -200,7 +216,8 @@ public int complement() {
/**
* Set value to value & b.
- * @return the new value
+ * @param b the value to AND with.
+ * @return the new value
**/
public int and(int b) {
synchronized (lock_) {
@@ -211,7 +228,8 @@ public int and(int b) {
/**
* Set value to value | b.
- * @return the new value
+ * @param b the value to OR with.
+ * @return the new value
**/
public int or(int b) {
synchronized (lock_) {
@@ -223,7 +241,8 @@ public int or(int b) {
/**
* Set value to value ^ b.
- * @return the new value
+ * @param b the value to XOR with.
+ * @return the new value
**/
public int xor(int b) {
synchronized (lock_) {
@@ -232,12 +251,26 @@ public int xor(int b) {
}
}
+ /**
+ * Compares the current value to the given int.
+ *
+ * @param other the value to compare against.
+ * @return a negative, zero, or positive integer as the current value is less than, equal to,
+ * or greater than other.
+ */
public int compareTo(int other) {
logger.debug("compareTo(other={}) - start", String.valueOf(other));
int val = get();
return (val < other)? -1 : (val == other)? 0 : 1;
}
+ /**
+ * Compares the current value to another {@code SynchronizedInt}'s value.
+ *
+ * @param other the instance to compare against.
+ * @return a negative, zero, or positive integer as the current value is less than, equal to,
+ * or greater than other's value.
+ */
public int compareTo(SynchronizedInt other) {
logger.debug("compareTo(other={}) - start", other);
return compareTo(other.get());
diff --git a/src/main/java/org/dbunit/util/concurrent/SynchronizedVariable.java b/src/main/java/org/dbunit/util/concurrent/SynchronizedVariable.java
index 2735f15f4..f383d1e9b 100644
--- a/src/main/java/org/dbunit/util/concurrent/SynchronizedVariable.java
+++ b/src/main/java/org/dbunit/util/concurrent/SynchronizedVariable.java
@@ -182,9 +182,14 @@ public class SynchronizedVariable implements Executor {
*/
private static final Logger logger = LoggerFactory.getLogger(SynchronizedVariable.class);
+ /** The lock used for all synchronization for this object. */
protected final Object lock_;
- /** Create a SynchronizedVariable using the supplied lock **/
+ /**
+ * Create a SynchronizedVariable using the supplied lock
+ *
+ * @param lock the synchronization lock to use.
+ **/
public SynchronizedVariable(Object lock) { lock_ = lock; }
/** Create a SynchronizedVariable using itself as the lock **/
@@ -192,6 +197,8 @@ public class SynchronizedVariable implements Executor {
/**
* Return the lock used for all synchronization for this object
+ *
+ * @return the lock used for all synchronization for this object.
**/
public Object getLock() {
return lock_;
diff --git a/src/main/java/org/dbunit/util/concurrent/SynchronousChannel.java b/src/main/java/org/dbunit/util/concurrent/SynchronousChannel.java
index 4f303dc41..d418d2ab2 100644
--- a/src/main/java/org/dbunit/util/concurrent/SynchronousChannel.java
+++ b/src/main/java/org/dbunit/util/concurrent/SynchronousChannel.java
@@ -89,29 +89,43 @@ protected static class Queue {
*/
private static final Logger logger = LoggerFactory.getLogger(Queue.class);
+ /** The first node in the queue, or {@code null} if empty. */
protected LinkedNode head;
+ /** The last node in the queue, or {@code null} if empty. */
protected LinkedNode last;
+ /**
+ * Appends the given node to the end of the queue.
+ *
+ * @param p the node to append.
+ */
protected void enq(LinkedNode p) {
logger.debug("enq(p={}) - start", p);
-
- if (last == null)
+
+ if (last == null)
last = head = p;
- else
+ else
last = last.next = p;
}
+ /**
+ * Removes and returns the node at the front of the queue.
+ *
+ * @return the node that was at the front of the queue, or {@code null} if empty.
+ */
protected LinkedNode deq() {
logger.debug("deq() - start");
LinkedNode p = head;
- if (p != null && (head = p.next) == null)
+ if (p != null && (head = p.next) == null)
last = null;
return p;
}
}
+ /** Queue of nodes for puts waiting for a taker. */
protected final Queue waitingPuts = new Queue();
+ /** Queue of nodes for takes waiting for a putter. */
protected final Queue waitingTakes = new Queue();
/**
@@ -130,7 +144,6 @@ public Object peek() {
logger.debug("peek() - start");
return null; }
-
public void put(Object x) throws InterruptedException {
logger.debug("put(x={}) - start", x);
@@ -263,7 +276,6 @@ public Object take() throws InterruptedException {
Offer and poll are just like put and take, except even messier.
*/
-
public boolean offer(Object x, long msecs) throws InterruptedException {
if(logger.isDebugEnabled())
logger.debug("offer(x={}, msecs={}) - start", x, String.valueOf(msecs));
diff --git a/src/main/java/org/dbunit/util/concurrent/TimeoutException.java b/src/main/java/org/dbunit/util/concurrent/TimeoutException.java
index a2bf13689..d4aacc87e 100644
--- a/src/main/java/org/dbunit/util/concurrent/TimeoutException.java
+++ b/src/main/java/org/dbunit/util/concurrent/TimeoutException.java
@@ -36,6 +36,8 @@ public class TimeoutException extends InterruptedException {
public final long duration;
/**
* Constructs a TimeoutException with given duration value.
+ *
+ * @param time the approximate time the operation lasted before timing out.
**/
public TimeoutException(long time) {
duration = time;
@@ -44,6 +46,9 @@ public TimeoutException(long time) {
/**
* Constructs a TimeoutException with the
* specified duration value and detail message.
+ *
+ * @param time the approximate time the operation lasted before timing out.
+ * @param message the detail message.
*/
public TimeoutException(long time, String message) {
super(message);
diff --git a/src/main/java/org/dbunit/util/search/AbstractExcludeNodesSearchCallback.java b/src/main/java/org/dbunit/util/search/AbstractExcludeNodesSearchCallback.java
index 023efcecb..61f788530 100644
--- a/src/main/java/org/dbunit/util/search/AbstractExcludeNodesSearchCallback.java
+++ b/src/main/java/org/dbunit/util/search/AbstractExcludeNodesSearchCallback.java
@@ -33,11 +33,21 @@
public abstract class AbstractExcludeNodesSearchCallback extends
AbstractNodesFilterSearchCallback {
+ /**
+ * Creates a callback that excludes the given denied nodes.
+ *
+ * @param deniedNodes the nodes to exclude from traversal.
+ */
public AbstractExcludeNodesSearchCallback(Set deniedNodes) {
super();
setDeniedNodes(deniedNodes);
}
+ /**
+ * Creates a callback that excludes the given denied nodes.
+ *
+ * @param deniedNodes the nodes to exclude from traversal.
+ */
public AbstractExcludeNodesSearchCallback(Object[] deniedNodes) {
super();
setDeniedNodes(deniedNodes);
diff --git a/src/main/java/org/dbunit/util/search/AbstractIncludeNodesSearchCallback.java b/src/main/java/org/dbunit/util/search/AbstractIncludeNodesSearchCallback.java
index 1fb1f576f..c350dddf5 100644
--- a/src/main/java/org/dbunit/util/search/AbstractIncludeNodesSearchCallback.java
+++ b/src/main/java/org/dbunit/util/search/AbstractIncludeNodesSearchCallback.java
@@ -33,11 +33,21 @@
public abstract class AbstractIncludeNodesSearchCallback extends
AbstractNodesFilterSearchCallback {
+ /**
+ * Creates a callback that restricts traversal to the given allowed nodes.
+ *
+ * @param allowedNodes the nodes to allow during traversal.
+ */
public AbstractIncludeNodesSearchCallback(Set allowedNodes) {
super();
setAllowedNodes(allowedNodes);
}
+ /**
+ * Creates a callback that restricts traversal to the given allowed nodes.
+ *
+ * @param allowedNodes the nodes to allow during traversal.
+ */
public AbstractIncludeNodesSearchCallback(Object[] allowedNodes) {
super();
setAllowedNodes(allowedNodes);
diff --git a/src/main/java/org/dbunit/util/search/AbstractNodesFilterSearchCallback.java b/src/main/java/org/dbunit/util/search/AbstractNodesFilterSearchCallback.java
index c0a1b7909..ad878d643 100644
--- a/src/main/java/org/dbunit/util/search/AbstractNodesFilterSearchCallback.java
+++ b/src/main/java/org/dbunit/util/search/AbstractNodesFilterSearchCallback.java
@@ -51,11 +51,17 @@
public abstract class AbstractNodesFilterSearchCallback implements
ISearchCallback {
+ /**
+ * Logger for this class.
+ */
protected final Logger logger = LoggerFactory.getLogger(getClass());
// internal modes
+ /** No nodes are allowed or denied; {@link #searchNode(Object)} always returns true. */
protected static final int NO_MODE = 0;
+ /** Only nodes set via {@link #setAllowedNodes(Set)} are allowed. */
protected static final int ALLOW_MODE = 1;
+ /** Only nodes set via {@link #setDeniedNodes(Set)} are denied. */
protected static final int DENY_MODE = 2;
private int filteringMode = NO_MODE;
diff --git a/src/main/java/org/dbunit/util/search/DepthFirstSearch.java b/src/main/java/org/dbunit/util/search/DepthFirstSearch.java
index 5893372b6..a459e120c 100644
--- a/src/main/java/org/dbunit/util/search/DepthFirstSearch.java
+++ b/src/main/java/org/dbunit/util/search/DepthFirstSearch.java
@@ -49,6 +49,9 @@ public class DepthFirstSearch implements ISearchAlgorithm {
private Set scannedNodes;
private Set reverseScannedNodes;
+ /**
+ * Logger for this class.
+ */
protected final Logger logger = LoggerFactory.getLogger(getClass());
// result of the search
@@ -93,6 +96,10 @@ public DepthFirstSearch(int searchDepth)
/**
* Alternative option to search() that takes an array of nodes as input (instead of a Set)
+ * @param nodesFrom the nodes to start the search from.
+ * @param callback the callback used to help the search.
+ * @return the set of nodes found by the search, including the input nodes and their dependencies.
+ * @throws SearchException if an exception occurs while getting the edges.
* @see ISearchAlgorithm
*/
public Set search(Object[] nodesFrom, ISearchCallback callback)
diff --git a/src/main/java/org/dbunit/util/search/Edge.java b/src/main/java/org/dbunit/util/search/Edge.java
index 3a7a746d4..1d2e3a0ac 100644
--- a/src/main/java/org/dbunit/util/search/Edge.java
+++ b/src/main/java/org/dbunit/util/search/Edge.java
@@ -42,8 +42,10 @@ public class Edge implements IEdge {
private final Comparable nodeTo;
/**
- * @param nodeFrom
- * @param nodeTo
+ * Creates an edge between the given nodes.
+ *
+ * @param nodeFrom the 'from' node.
+ * @param nodeTo the 'to' node.
*/
public Edge(final Comparable nodeFrom, final Comparable nodeTo) {
if (nodeFrom == null) {
diff --git a/src/main/java/org/dbunit/util/search/SearchException.java b/src/main/java/org/dbunit/util/search/SearchException.java
index 319574152..9f99b674e 100644
--- a/src/main/java/org/dbunit/util/search/SearchException.java
+++ b/src/main/java/org/dbunit/util/search/SearchException.java
@@ -34,17 +34,36 @@ public class SearchException extends DatabaseUnitException {
private static final long serialVersionUID = -8369726048539373231L;
+ /**
+ * Default constructor.
+ */
public SearchException() {
}
+ /**
+ * Constructs a SearchException with the specified detail message.
+ *
+ * @param msg the detail message.
+ */
public SearchException(String msg) {
super(msg);
}
+ /**
+ * Constructs a SearchException with the specified detail message and cause.
+ *
+ * @param msg the detail message.
+ * @param e the cause.
+ */
public SearchException(String msg, Throwable e) {
super(msg, e);
}
+ /**
+ * Constructs a SearchException with the specified cause.
+ *
+ * @param e the cause.
+ */
public SearchException(Throwable e) {
super(e);
}
diff --git a/src/main/java/org/dbunit/util/xml/XmlWriter.java b/src/main/java/org/dbunit/util/xml/XmlWriter.java
index 1bbb31cb5..a3fee7f08 100644
--- a/src/main/java/org/dbunit/util/xml/XmlWriter.java
+++ b/src/main/java/org/dbunit/util/xml/XmlWriter.java
@@ -95,6 +95,7 @@ public class XmlWriter
*/
public static final String DEFAULT_ENCODING = "UTF-8";
+ /** Default charset, {@value #DEFAULT_ENCODING}. */
public static final Charset DEFAULT_CHARSET = StandardCharsets.UTF_8;
/**
@@ -149,6 +150,8 @@ public class XmlWriter
/**
* Create an XmlWriter on top of an existing java.io.Writer.
+ *
+ * @param writer the writer to write to.
*/
public XmlWriter(final Writer writer)
{
@@ -157,6 +160,9 @@ public XmlWriter(final Writer writer)
/**
* Create an XmlWriter on top of an existing java.io.Writer.
+ *
+ * @param writer the writer to write to.
+ * @param charset the charset to declare in the XML prolog, may be null.
*/
public XmlWriter(final Writer writer, final Charset charset)
{
@@ -166,7 +172,7 @@ public XmlWriter(final Writer writer, final Charset charset)
/**
* Create an XmlWriter on top of an existing {@link java.io.OutputStream}.
*
- * @param outputStream
+ * @param outputStream the stream to write to.
* @param charset
* The charset to be used for writing to the given output stream.
* Can be null. If it is null the
@@ -240,6 +246,8 @@ public void setNewline(final String newline)
* String name of tag
* @param text
* String of text to go inside the tag
+ * @return this writer.
+ * @throws IOException if writing fails.
*/
public XmlWriter writeElementWithText(final String name, final String text)
throws IOException
@@ -257,6 +265,8 @@ public XmlWriter writeElementWithText(final String name, final String text)
*
* @param name
* String name of tag
+ * @return this writer.
+ * @throws IOException if writing fails.
*/
public XmlWriter writeEmptyElement(final String name) throws IOException
{
@@ -272,6 +282,8 @@ public XmlWriter writeEmptyElement(final String name) throws IOException
*
* @param name
* String name of tag
+ * @return this writer.
+ * @throws IOException if writing fails.
*/
public XmlWriter writeElement(final String name) throws IOException
{
@@ -352,6 +364,8 @@ private void writeAttributes() throws IOException
* name of attribute.
* @param value
* value of attribute.
+ * @return this writer.
+ * @throws IOException if writing fails.
* @see #writeAttribute(String, String, boolean)
*/
public XmlWriter writeAttribute(final String attr, final String value)
@@ -374,6 +388,8 @@ public XmlWriter writeAttribute(final String attr, final String value)
* If the writer should be literally on the given value which
* means that meta characters will also be preserved by escaping
* them. Mainly preserves newlines and tabs.
+ * @return this writer.
+ * @throws IOException if writing fails.
*/
public XmlWriter writeAttribute(final String attr, final String value,
final boolean literally) throws IOException
@@ -411,6 +427,9 @@ public XmlWriter writeAttribute(final String attr, final String value,
/**
* End the current element. This will throw an exception if it is called
* when there is not a currently open element.
+ *
+ * @return this writer.
+ * @throws IOException if there is no currently open element, or writing fails.
*/
public XmlWriter endElement() throws IOException
{
@@ -455,6 +474,8 @@ public XmlWriter endElement() throws IOException
/**
* Close this writer. It does not close the underlying writer, but does
* throw an exception if there are as yet unclosed tags.
+ *
+ * @throws IOException if there are unclosed tags, or flushing fails.
*/
public void close() throws IOException
{
@@ -488,7 +509,7 @@ public void flush() throws IOException
* @param text
* The text to be written
* @return This writer
- * @throws IOException
+ * @throws IOException if writing fails.
* @see #writeText(String, boolean)
*/
public XmlWriter writeText(final String text) throws IOException
@@ -507,7 +528,7 @@ public XmlWriter writeText(final String text) throws IOException
* means that meta characters will also be preserved by escaping
* them. Mainly preserves newlines and tabs.
* @return This writer
- * @throws IOException
+ * @throws IOException if writing fails.
*/
public XmlWriter writeText(final String text, final boolean literally)
throws IOException
@@ -532,6 +553,8 @@ public XmlWriter writeText(final String text, final boolean literally)
*
* @param cdata
* of CDATA text.
+ * @return this writer.
+ * @throws IOException if writing fails.
*/
public XmlWriter writeCData(String cdata) throws IOException
{
@@ -576,6 +599,8 @@ public XmlWriter writeCData(String cdata) throws IOException
*
* @param comment
* of text to comment.
+ * @return this writer.
+ * @throws IOException if writing fails.
*/
public XmlWriter writeComment(final String comment) throws IOException
{
@@ -612,6 +637,12 @@ private void writeChunk(final String data) throws IOException
// Two example methods. They should output the same XML:
// 425343
+ /**
+ * Runs {@link #test1()} and {@link #test2()}, printing their output for manual inspection.
+ *
+ * @param args ignored.
+ * @throws IOException if writing the example XML fails.
+ */
static public void main(final String[] args) throws IOException
{
logger.debug("main(args={}) - start", (Object) args);
@@ -620,6 +651,11 @@ static public void main(final String[] args) throws IOException
test2();
}
+ /**
+ * Writes an example XML document using the fluent {@link #writeElement(String)} style.
+ *
+ * @throws IOException if writing the example XML fails.
+ */
static public void test1() throws IOException
{
logger.debug("test1() - start");
@@ -635,6 +671,11 @@ static public void test1() throws IOException
System.err.println(writer.toString());
}
+ /**
+ * Writes the same example XML document as {@link #test1()}, using the step-by-step style.
+ *
+ * @throws IOException if writing the example XML fails.
+ */
static public void test2() throws IOException
{
logger.debug("test2() - start");
@@ -758,6 +799,14 @@ private String escapeXml(final String str, final boolean literally)
return buffer.toString();
}
+ /**
+ * Returns the XML entity for the given character, if any.
+ *
+ * @param currentChar the character to convert.
+ * @param literally whether the character was written via a "literal" write method,
+ * which affects which characters are converted.
+ * @return the XML entity for the given character, or null if it needs no entity.
+ */
protected String convertCharacterToEntity(final char currentChar,
final boolean literally)
{
@@ -895,6 +944,12 @@ final public void setWriter(final Writer writer, final String encoding)
setWriter(writer, Charset.forName(encoding));
}
+ /**
+ * Sets the writer and character set to write to.
+ *
+ * @param writer the writer to write to.
+ * @param charset the character set to encode the declaration with.
+ */
final public void setWriter(final Writer writer, final Charset charset)
{
logger.debug("setWriter(writer={}, charset={}) - start", writer,
@@ -916,6 +971,12 @@ final public void setWriter(final Writer writer, final Charset charset)
}
}
+ /**
+ * Writes the XML declaration, if an encoding is set.
+ *
+ * @return this writer, for chaining.
+ * @throws IOException if writing to the underlying stream fails.
+ */
public XmlWriter writeDeclaration() throws IOException
{
logger.debug("writeDeclaration() - start");
@@ -931,6 +992,14 @@ public XmlWriter writeDeclaration() throws IOException
return this;
}
+ /**
+ * Writes a DOCTYPE declaration for the dataset, if a system or public id is given.
+ *
+ * @param systemId the DTD's system id, or null.
+ * @param publicId the DTD's public id, or null.
+ * @return this writer, for chaining.
+ * @throws IOException if writing to the underlying stream fails.
+ */
public XmlWriter writeDoctype(final String systemId, final String publicId)
throws IOException
{
diff --git a/src/test/java/org/dbunit/DatabaseEnvironment.java b/src/test/java/org/dbunit/DatabaseEnvironment.java
index e31b104ba..9df6eac07 100644
--- a/src/test/java/org/dbunit/DatabaseEnvironment.java
+++ b/src/test/java/org/dbunit/DatabaseEnvironment.java
@@ -76,8 +76,6 @@ public class DatabaseEnvironment
*
* Following is a few properties as an example of the content of
* "dbunit.properties":
- *
- *
*
* database.profile=h2
* dbunit.profile.driverClass=org.hsqldb.jdbcDriver