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

org.datacleaner.data.MockInputColumn Maven / Gradle / Ivy

/**
 * DataCleaner (community edition)
 * Copyright (C) 2014 Free Software Foundation, Inc.
 *
 * This copyrighted material is made available to anyone wishing to use, modify,
 * copy, or redistribute it subject to the terms and conditions of the GNU
 * Lesser General Public License, as published by the Free Software Foundation.
 *
 * This program is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
 * or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Lesser General Public License
 * for more details.
 *
 * You should have received a copy of the GNU Lesser General Public License
 * along with this distribution; if not, write to:
 * Free Software Foundation, Inc.
 * 51 Franklin Street, Fifth Floor
 * Boston, MA  02110-1301  USA
 */
package org.datacleaner.data;

import org.apache.metamodel.schema.Column;

/**
 * A mock-implementation of the input column. Use this only for testing purposes
 * or in cases where you want to circumvent the actual framework!
 *
 * @param 
 */
public class MockInputColumn extends AbstractInputColumn {

    private static final long serialVersionUID = 1L;
    private final Class _clazz;
    private final Column _physicalColumn;
    private String _name;

    public MockInputColumn(final Column physicalColumn, final Class clazz) {
        this(physicalColumn.getName(), clazz, physicalColumn);
    }

    public MockInputColumn(final String name) {
        this(name, null);
    }

    public MockInputColumn(final String name, final Class clazz) {
        this(name, clazz, null);
    }

    public MockInputColumn(final String name, final Class clazz, final Column physicalColumn) {
        _name = name;
        _clazz = clazz;
        _physicalColumn = physicalColumn;
    }

    @Override
    public Class getDataType() {
        return _clazz;
    }

    @Override
    public String getName() {
        return _name;
    }

    public void setName(final String name) {
        _name = name;
    }

    @Override
    protected Column getPhysicalColumnInternal() {
        return _physicalColumn;
    }

    @Override
    protected int hashCodeInternal() {
        return _name.hashCode();
    }

    @Override
    protected boolean equalsInternal(final AbstractInputColumn that) {
        return this == that;
    }

    @Override
    public String toString() {
        return "MockInputColumn[name=" + _name + "]";
    }
}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy