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

org.simpleflatmapper.jdbc.impl.ColumnMeta Maven / Gradle / Ivy

Go to download

Java library to map flat record - ResultSet, csv - to java object with minimum configuration and low footprint.

There is a newer version: 9.0.2
Show newest version
package org.simpleflatmapper.jdbc.impl;

import org.simpleflatmapper.jdbc.JdbcColumnKey;
import org.simpleflatmapper.map.property.AutoGeneratedProperty;

public class ColumnMeta {
    private final String column;
    private final int sqlType;
    private final boolean key;
    private final AutoGeneratedProperty generated;

    public ColumnMeta(String column, int sqlType, boolean key, AutoGeneratedProperty generated) {
        this.column = column;
        this.sqlType = sqlType;
        this.key = key;
        this.generated = generated;
    }

    public String getColumn() {
        return column;
    }

    public int getSqlType() {
        return sqlType;
    }

    public boolean isKey() {
        return key;
    }

    public boolean isGenerated() {
        return generated != null;
    }

    public JdbcColumnKey toJdbcColumnKey(int index) {
        return new JdbcColumnKey(column, index, sqlType);
    }

    public boolean isInsertable() {
        return generated == null || generated.getExpression() != null;
    }

    public String getInsertExpression() {
        return generated == null ? "?" : generated.getExpression();
    }
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy