public abstract class TableModelUtils extends Object
| Modifier and Type | Field and Description |
|---|---|
static String |
OPT_CLASS_ANNOTATION |
static String |
OPT_CLASS_DEFINITION |
static String |
OPT_EXCLUDE_TABLES |
static String |
OPT_FIELD_FLAGS |
static String |
OPT_FIELD_FLAGS_STATIC |
static String |
OPT_FIELD_FLAGS_STYLE |
static String |
OPT_FIELDS |
static String |
OPT_GETTER_SETTERS |
static String |
OPT_IMPORTS |
static String |
OPT_LINK_STYLE |
static String |
OPT_PACKAGE_NAME |
static String |
OPT_PUBLIC_FIELD |
static String |
OPT_REMOVE_DEFAULT_IMPORTS |
| Constructor and Description |
|---|
TableModelUtils() |
| Modifier and Type | Method and Description |
|---|---|
static void |
bindGlobalModel(Class<?> entityClass,
TableModel tableModel)
This method bind a tableModel to a entity class, this is a global setting
|
static void |
db2Excel(Connection con,
Dialect dialect,
String fileName)
Export entity to excel csv files
|
static void |
db2JavaSrcFiles(DataSource ds,
Dialect dialect,
String outputfolder,
Map<String,Object> setting)
Read database structure and write them to Java entity class source code
|
static TableModel[] |
db2Models(Connection con,
Dialect dialect)
Convert database metaData to TableModels, note:
1)This method does not close connection, do not forgot close it later 2)This method does not read sequence, index, unique constraints |
static void |
db2QClassSrcFiles(DataSource ds,
Dialect dialect,
String outputFolder,
String packageName,
String prefix)
Read database structure and write them to Java entity class source code
|
static void |
entity2Excel(String fileName,
Class<?>... entityClasses)
Convert entity classes to excel in csv files
|
static TableModel |
entity2Model(Class<?> entityClass)
Convert entity class to a editable TableModel instance
|
static TableModel[] |
entity2Models(Class<?>... entityClasses)
Convert entity classes to editable TableModel instances
|
static TableModel |
entity2ReadOnlyModel(Class<?> entityClass)
Convert entity class to a read-only TableModel instance
|
static TableModel[] |
entity2ReadOnlyModels(Class<?>... entityClasses)
Convert entity classes to read-only TableModel instances
|
static void |
entityPackage2Excel(String pkgName,
String fileName)
Export entity to excel in csv files
|
static String |
model2JavaSrc(TableModel model,
Map<String,Object> setting)
Convert a TablemModel instance to Java entity class source code
|
static Class<?> |
tableNameToEntityClass(String tableName)
Convert tableName to entity class, note: before use this method
entity2Models() method should be called first to cache talbeModels in memory
|
public static final String OPT_EXCLUDE_TABLES
public static final String OPT_PACKAGE_NAME
public static final String OPT_IMPORTS
public static final String OPT_REMOVE_DEFAULT_IMPORTS
public static final String OPT_CLASS_ANNOTATION
public static final String OPT_CLASS_DEFINITION
public static final String OPT_FIELD_FLAGS_STATIC
public static final String OPT_FIELD_FLAGS
public static final String OPT_FIELD_FLAGS_STYLE
public static final String OPT_PUBLIC_FIELD
public static final String OPT_FIELDS
public static final String OPT_GETTER_SETTERS
public static final String OPT_LINK_STYLE
public static Class<?> tableNameToEntityClass(String tableName)
public static TableModel entity2Model(Class<?> entityClass)
public static TableModel[] entity2Models(Class<?>... entityClasses)
public static TableModel entity2ReadOnlyModel(Class<?> entityClass)
public static TableModel[] entity2ReadOnlyModels(Class<?>... entityClasses)
public static TableModel[] db2Models(Connection con, Dialect dialect)
public static void db2JavaSrcFiles(DataSource ds, Dialect dialect, String outputfolder, Map<String,Object> setting)
ds - The DataSource instancedialect - The dialect of databaseoutputfolder - the out put foldersetting - see TableModelUtilsOfJavaSrc.modelToJavaSourceCode() methodpublic static void db2QClassSrcFiles(DataSource ds, Dialect dialect, String outputFolder, String packageName, String prefix)
ds - The DataSource instancedialect - The dialect of databaseoutputfolder - the out put folderpackageName - package nameprefix - class prefix, for example: "Q" or "P"public static String model2JavaSrc(TableModel model, Map<String,Object> setting)
model - The TableModel instancesetting - see TableModelUtilsOfJavaSrc.modelToJavaSourceCode() methodpublic static void bindGlobalModel(Class<?> entityClass, TableModel tableModel)
public static void entityPackage2Excel(String pkgName, String fileName)
pkgName - fileName - public static void entity2Excel(String fileName, Class<?>... entityClasses)
fileName - entityClasses - public static void db2Excel(Connection con, Dialect dialect, String fileName)
con - dialect - fileName - Copyright © 2021. All rights reserved.