view src/main/java/nl/cwi/monetdb/embedded/tables/MonetDBTableColumn.java @ 51:c592d8a72627 embedded

More defensive approach for tables. Only the table name and schema are cached.
author Pedro Ferreira <pedro.ferreira@monetdbsolutions.com>
date Wed, 16 Nov 2016 21:21:26 +0100 (2016-11-16)
parents 8353929359d6
children 6617eaf808cb
line wrap: on
line source
package nl.cwi.monetdb.embedded.tables;

import nl.cwi.monetdb.embedded.mapping.AbstractColumn;

/**
 * Java representation of a MonetDB table column.
 *
 * @author <a href="mailto:pedro.ferreira@monetdbsolutions.com">Pedro Ferreira</a>
 */
public class MonetDBTableColumn extends AbstractColumn {

    private final String columnName;

    private final int columnDigits;

    private final int columnScale;

    private final String defaultValue;

    private final boolean isNullable;

    protected MonetDBTableColumn(String columnType, String columnName, int columnDigits, int columnScale,
                                 String defaultValue, boolean isNullable) {
        super(columnType);
        this.columnName = columnName;
        this.columnDigits = columnDigits;
        this.columnScale = columnScale;
        this.defaultValue = defaultValue;
        this.isNullable = isNullable;
    }

    @Override
    public String getColumnName() { return this.columnName; }

    @Override
    public int getColumnDigits() { return this.columnDigits; }

    @Override
    public int getColumnScale() { return this.columnScale; }

    /**
     * Get the default value if there is one, or null if none.
     *
     * @return The default value if there is one, or null if none
     */
    public String getDefaultValue() { return this.defaultValue; }

    /**
     * Get the indication if the column is nullable.
     *
     * @return The indication if the column is nullable
     */
    public boolean isNullable() { return this.isNullable; }
}