org.simpleflatmapper.jdbc.impl.DatabaseMeta Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of sfm-jdbc Show documentation
Show all versions of sfm-jdbc Show documentation
Java library to map flat record - ResultSet, csv - to java object with minimum configuration and low footprint.
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;
}
}