public class MetaDataExporter extends Object
Example
MetaDataExporter exporter = new MetaDataExporter(); exporter.setPackageName("com.example.domain"); exporter.setTargetFolder(new File("target/generated-sources/java")); exporter.export(connection.getMetaData());
Constructor and Description |
---|
MetaDataExporter() |
Modifier and Type | Method and Description |
---|---|
protected EntityType |
createEntityType(String schemaName,
String tableName,
String className) |
protected Property |
createProperty(EntityType classModel,
String normalizedColumnName,
String propertyName,
com.mysema.codegen.model.Type typeModel) |
void |
export(DatabaseMetaData md)
Export the tables based on the given database metadata
|
void |
setBeanPackageName(String beanPackageName)
Override the bean package name (default: packageName)
|
void |
setBeanPrefix(String beanPrefix)
Override the bean prefix for the classes (default: "")
|
void |
setBeanSerializer(Serializer beanSerializer)
Set the Bean serializer to create bean types as well
|
void |
setBeanSerializerClass(Class<? extends Serializer> beanSerializerClass)
Set the Bean serializer class to create bean types as well
|
void |
setBeanSuffix(String beanSuffix)
Override the bean suffix for the classes (default: "")
|
void |
setColumnAnnotations(boolean columnAnnotations) |
void |
setColumnComparatorClass(Class<? extends Comparator<Property>> columnComparatorClass) |
void |
setConfiguration(Configuration configuration)
Override the configuration
|
void |
setCreateScalaSources(boolean createScalaSources)
Set true to create Scala sources instead of Java sources
|
void |
setExportAll(boolean exportAll) |
void |
setExportForeignKeys(boolean exportForeignKeys) |
void |
setExportPrimaryKeys(boolean exportPrimaryKeys) |
void |
setExportTables(boolean exportTables) |
void |
setExportViews(boolean exportViews) |
void |
setImports(String[] imports)
Set the java imports
|
void |
setInnerClassesForKeys(boolean innerClassesForKeys) |
void |
setLowerCase(boolean lowerCase) |
void |
setNamePrefix(String namePrefix)
Override the name prefix for the classes (default: Q)
|
void |
setNameSuffix(String nameSuffix)
Override the name suffix for the classes (default: "")
|
void |
setNamingStrategy(NamingStrategy namingStrategy)
Override the NamingStrategy (default: new DefaultNamingStrategy())
|
void |
setPackageName(String packageName)
Set the package name
|
void |
setSchemaPattern(String schemaPattern)
Set the schema pattern filter to be used
|
void |
setSchemaToPackage(boolean schemaToPackage) |
void |
setSerializerClass(Class<? extends Serializer> serializerClass) |
void |
setSourceEncoding(String sourceEncoding) |
void |
setSpatial(boolean spatial) |
void |
setTableNamePattern(String tableNamePattern)
Set the table name pattern filter to be used
|
void |
setTableTypesToExport(String tableTypesToExport) |
void |
setTargetFolder(File targetFolder)
Set the target folder
|
void |
setTypeMappings(TypeMappings typeMappings) |
void |
setValidationAnnotations(boolean validationAnnotations) |
protected EntityType createEntityType(@Nullable String schemaName, String tableName, String className)
protected Property createProperty(EntityType classModel, String normalizedColumnName, String propertyName, com.mysema.codegen.model.Type typeModel)
public void export(DatabaseMetaData md) throws SQLException
md
- SQLException
public void setSchemaPattern(@Nullable String schemaPattern)
schemaPattern
- a schema name pattern; must match the schema name
as it is stored in the database; "" retrieves those without a schema;
null
means that the schema name should not be used to narrow
the search (default: null)public void setTableNamePattern(@Nullable String tableNamePattern)
tableNamePattern
- a table name pattern; must match the
table name as it is stored in the database (default: null)public void setConfiguration(Configuration configuration)
configuration
- override configuration for custom type mappings etcpublic void setCreateScalaSources(boolean createScalaSources)
createScalaSources
- whether to create Scala sources (default: false)public void setTargetFolder(File targetFolder)
targetFolder
- target source folder to create the sources into
(e.g. target/generated-sources/java)public void setPackageName(String packageName)
packageName
- package name for sourcespublic void setBeanPackageName(@Nullable String beanPackageName)
beanPackageName
- public void setNamePrefix(String namePrefix)
namePrefix
- name prefix for query-types (default: Q)public void setNameSuffix(String nameSuffix)
nameSuffix
- name suffix for query-types (default: "")public void setBeanPrefix(String beanPrefix)
beanPrefix
- bean prefix for bean-types (default: "")public void setBeanSuffix(String beanSuffix)
beanSuffix
- bean suffix for bean-types (default: "")public void setNamingStrategy(NamingStrategy namingStrategy)
namingStrategy
- namingstrategy to override (default: new DefaultNamingStrategy())public void setBeanSerializer(@Nullable Serializer beanSerializer)
beanSerializer
- serializer for JavaBeans (default: null)public void setBeanSerializerClass(Class<? extends Serializer> beanSerializerClass)
beanSerializerClass
- serializer for JavaBeans (default: null)public void setInnerClassesForKeys(boolean innerClassesForKeys)
innerClassesForKeys
- public void setColumnComparatorClass(Class<? extends Comparator<Property>> columnComparatorClass)
columnComparatorClass
- public void setSerializerClass(Class<? extends Serializer> serializerClass)
serializerClass
- public void setTypeMappings(TypeMappings typeMappings)
typeMappings
- public void setColumnAnnotations(boolean columnAnnotations)
columnAnnotations
- public void setValidationAnnotations(boolean validationAnnotations)
validationAnnotations
- public void setSourceEncoding(String sourceEncoding)
sourceEncoding
- public void setSchemaToPackage(boolean schemaToPackage)
schemaToPackage
- public void setLowerCase(boolean lowerCase)
lowerCase
- public void setExportTables(boolean exportTables)
exportTables
- public void setExportViews(boolean exportViews)
exportViews
- public void setExportAll(boolean exportAll)
exportAll
- public void setExportPrimaryKeys(boolean exportPrimaryKeys)
exportPrimaryKeys
- public void setExportForeignKeys(boolean exportForeignKeys)
exportForeignKeys
- public void setImports(String[] imports)
imports
- java imports arraypublic void setSpatial(boolean spatial)
spatial
- public void setTableTypesToExport(String tableTypesToExport)
tableTypesToExport
- Copyright © 2007–2015 Mysema Ltd. All rights reserved.