com.bixuebihui.jdbc.IPrimaryKeyedTable Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of c-dbtools Show documentation
Show all versions of c-dbtools Show documentation
a fast small database connection pool and a active record flavor mini framework
package com.bixuebihui.jdbc;
import org.apache.commons.lang3.StringUtils;
/**
* @author xwx
*/
public interface IPrimaryKeyedTable {
/**
* getId.
*
* @param info a T object.
* @return a V object.
*/
V getId(T info);
/**
* setId.
*
* @param info a T object.
* @param id a V object.
*/
void setId(T info, V id);
/**
* getTableName.
*
* @return a {@link java.lang.String} object.
*/
String getTableName();
/**
* Database name
* @return db name
*/
String getDatabaseName();
/**
* primary key field name, if exists such, or null
*
* @return primary key field name, if exists such, or null
*/
String getKeyName();
/**
* return table name or alias or sharded table name
* @param tableName
* @return table name
*/
default String getTableName(String tableName) {
return (StringUtils.isBlank(tableName) ? getTableName() : tableName);
}
}