wiki.xsx.jg.core.Database Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of JG-All Show documentation
Show all versions of JG-All Show documentation
a generator, from the database tables convert to the Java classes or from the Java classes convert to the database tables.
support mysql, oracle, sqlserver and postgresql.
package wiki.xsx.jg.core;
import java.util.HashMap;
import java.util.HashSet;
import java.util.Map;
import java.util.Set;
/**
* 数据库对象
*/
public class Database {
// 数据库名称
private String name;
// 数据库类型名称
private String typeName;
// 数据库概要(数据库中的Schema,为数据库对象的集合,一个用户一般对应一个schema)
private String schema;
// 数据库驱动名称
private String driverClassName;
// 数据库地址
private String url;
// 数据库用户名
private String userName;
// 数据库密码
private String password;
// 数据库表集合
private Map tableMap = new HashMap<>();
public Database(String name, String typeName, String schema, String driverClassName, String url, String userName, String password) {
this.name = name;
this.typeName = typeName;
this.schema = schema;
this.driverClassName = driverClassName;
this.url = url;
this.userName = userName;
this.password = password;
}
public String getName() {
return name;
}
public void setName(String name) {
this.name = name;
}
public String getTypeName() {
return typeName;
}
public void setTypeName(String typeName) {
this.typeName = typeName;
}
public String getSchema() {
return schema;
}
public void setSchema(String schema) {
this.schema = schema;
}
public String getDriverClassName() {
return driverClassName;
}
public void setDriverClassName(String driverClassName) {
this.driverClassName = driverClassName;
}
public String getUrl() {
return url;
}
public void setUrl(String url) {
this.url = url;
}
public String getUserName() {
return userName;
}
public void setUserName(String userName) {
this.userName = userName;
}
public String getPassword() {
return password;
}
public void setPassword(String password) {
this.password = password;
}
public Map getTableMap() {
return tableMap;
}
public Set getTableSet() {
return new HashSet<>(tableMap.values());
}
public Table getTable(String tableName) {
return tableMap.get(tableName);
}
public void setTableMap(Map tableMap) {
this.tableMap = tableMap;
}
@Override
public String toString() {
return "Database{" +
"name='" + name + '\'' +
", schema='" + schema + '\'' +
", driverClassName='" + driverClassName + '\'' +
", url='" + url + '\'' +
", userName='" + userName + '\'' +
", password='" + password + '\'' +
", tableMap=" + tableMap +
'}';
}
}
© 2015 - 2024 Weber Informatics LLC | Privacy Policy