All Downloads are FREE. Search and download functionalities are using the official Maven repository.

org.unitils.dbunit.datasetfactory.impl.DbUnitTableMetaData Maven / Gradle / Ivy

There is a newer version: 3.4.6
Show newest version
/*
 * Copyright 2013,  Unitils.org
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *     http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */
package org.unitils.dbunit.datasetfactory.impl;

import org.dbunit.dataset.AbstractTableMetaData;
import org.dbunit.dataset.Column;
import org.dbunit.dataset.DataSetException;

import java.util.ArrayList;
import java.util.LinkedHashSet;
import java.util.List;
import java.util.Set;

/**
 * @author Tim Ducheyne
 */
public class DbUnitTableMetaData extends AbstractTableMetaData {


    protected String tableName;
    protected Set columns = new LinkedHashSet(10);
    protected List columnNames = new ArrayList(10);


    public DbUnitTableMetaData(String tableName) {
        this.tableName = tableName;
    }


    public String getTableName() {
        return tableName;
    }

    public Column[] getColumns() throws DataSetException {
        return columns.toArray(new Column[columns.size()]);
    }

    public void addColumn(Column column) {
        boolean added = columns.add(column);
        if (added) {
            columnNames.add(column.getColumnName());
        }
    }

    public Column[] getPrimaryKeys() throws DataSetException {
        return new Column[0];
    }

    public List getColumnNames() {
        return columnNames;
    }
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy