Permalink
Browse files

Merge pull request #2041 from bmleite/master

Enable AntMetaDataExporter "namingStrategyClass" and "beanSerializerClass" properties
  • Loading branch information...
2 parents a301fe7 + dbaaf0a commit b40b4928f0ffa640770ad9405082a93865c73255 @Shredder121 Shredder121 committed on GitHub Dec 15, 2016
@@ -121,12 +121,12 @@
/**
* naming strategy class to override (default: DefaultNamingStrategy)
*/
- private String namingStrategyClass;
+ private String namingStrategyClass = DefaultNamingStrategy.class.getName();
/**
- * bean serializer class
+ * bean serializer class (default: BeanSerializer)
*/
- private String beanSerializerClass;
+ private String beanSerializerClass = BeanSerializer.class.getName();
/**
* serializer class to override
@@ -286,7 +286,6 @@ public void execute() {
dbConn = DriverManager.getConnection(jdbcUrl, jdbcUser, jdbcPassword);
Configuration configuration = new Configuration(SQLTemplates.DEFAULT);
- NamingStrategy namingStrategy = new DefaultNamingStrategy();
MetaDataExporter exporter = new MetaDataExporter();
if (namePrefix != null) {
exporter.setNamePrefix(namePrefix);
@@ -306,7 +305,7 @@ public void execute() {
exporter.setPackageName(packageName);
exporter.setBeanPackageName(beanPackageName);
exporter.setTargetFolder(new File(targetFolder));
- exporter.setNamingStrategy(namingStrategy);
+ exporter.setNamingStrategy((NamingStrategy) Class.forName(namingStrategyClass).newInstance());
exporter.setInnerClassesForKeys(innerClassesForKeys);
exporter.setSchemaPattern(schemaPattern);
exporter.setTableNamePattern(tableNamePattern);
@@ -329,7 +328,7 @@ public void execute() {
}
if (exportBeans) {
- BeanSerializer serializer = new BeanSerializer();
+ BeanSerializer serializer = (BeanSerializer) Class.forName(beanSerializerClass).newInstance();
if (beanInterfaces != null) {
for (String iface : beanInterfaces) {
int sepIndex = iface.lastIndexOf('.');

0 comments on commit b40b492

Please sign in to comment.