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

org.simpleflatmapper.jdbc.impl.DatabaseMeta 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;

public class DatabaseMeta {

    private final String product;
    private final int majorVersion;
    private final int minorVersion;

    public DatabaseMeta(String product, int majorVersion, int minorVersion) {
        this.product = product;
        this.majorVersion = majorVersion;
        this.minorVersion = minorVersion;
    }

    public boolean isMysql() {
        return "MySQL".equals(product);
    }

    public boolean isPostgresSql() {
        return "PostgreSQL".equals(product);
    }

    @Override
    public String toString() {
        return "DatabaseMeta{" +
                "product='" + product + '\'' +
                ", majorVersion=" + majorVersion +
                ", minorVersion=" + minorVersion +
                '}';
    }

    public boolean isVersionMet(int major, int minor) {
        if (major < majorVersion) {
            return true;
        } else if (major == majorVersion) {
            return minor <= minorVersion;
        }
        return false;
    }
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy