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

cdc.util.rdb.tools.dump.TableConfig Maven / Gradle / Ivy

There is a newer version: 0.9.0
Show newest version
package cdc.util.rdb.tools.dump;

import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.Set;

/**
 * Table configuration.
 *
 * @author Damien Carbonne
 *
 */
public final class TableConfig extends AbstractNamedConfig {
    final Map columns = new HashMap<>();
    final List sorting = new ArrayList<>();

    TableConfig(SchemaConfig parent,
                String internal) {
        super(parent, internal);
        setProcessing(Processing.INHERIT);
    }

    @Override
    public SchemaConfig getParent() {
        return (SchemaConfig) super.getParent();
    }

    @Override
    public EffectiveProcessing getEffectiveProcessing() {
        return toEffectiveProcessing(columns.values());
    }

    public Set getColumnsNames() {
        return columns.keySet();
    }

    public ColumnConfig getOrCreateColumnConfig(String columnName) {
        return columns.computeIfAbsent(columnName, s -> new ColumnConfig(this, s));
    }

    /**
     * Returns the configuration associated to a column.
     *
     * @param columnName The internal column name.
     * @return The configuration associated to {@code columnName} or null.
     */
    public ColumnConfig getColumnConfig(String columnName) {
        return columns.get(columnName);
    }

    public void addColumnSorting(ColumnSorting sorting) {
        this.sorting.add(sorting);
    }

    public List getColumnsSorting() {
        return sorting;
    }
}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy