diff --git a/common/pom.xml b/common/pom.xml
new file mode 100644
index 0000000..698710d
--- /dev/null
+++ b/common/pom.xml
@@ -0,0 +1,27 @@
+
+
+ 4.0.0
+
+ com.moparisthebest.jdbcmapper
+ jdbcmapper-parent
+ 1.0-SNAPSHOT
+
+ common
+ ${project.artifactId}
+
+
+ junit
+ junit
+ test
+
+
+ org.apache.derby
+ derby
+ test
+ true
+
+
+
+ ${project.artifactId}
+
+
diff --git a/querymapper/src/main/java/com/moparisthebest/jdbc/Cleaner.java b/common/src/main/java/com/moparisthebest/jdbc/Cleaner.java
similarity index 100%
rename from querymapper/src/main/java/com/moparisthebest/jdbc/Cleaner.java
rename to common/src/main/java/com/moparisthebest/jdbc/Cleaner.java
diff --git a/querymapper/src/main/java/com/moparisthebest/jdbc/Finishable.java b/common/src/main/java/com/moparisthebest/jdbc/Finishable.java
similarity index 100%
rename from querymapper/src/main/java/com/moparisthebest/jdbc/Finishable.java
rename to common/src/main/java/com/moparisthebest/jdbc/Finishable.java
diff --git a/querymapper/src/main/java/com/moparisthebest/jdbc/TryClose.java b/common/src/main/java/com/moparisthebest/jdbc/TryClose.java
similarity index 100%
rename from querymapper/src/main/java/com/moparisthebest/jdbc/TryClose.java
rename to common/src/main/java/com/moparisthebest/jdbc/TryClose.java
diff --git a/querymapper/src/main/java/com/moparisthebest/jdbc/codegen/JdbcMapper.java b/common/src/main/java/com/moparisthebest/jdbc/codegen/JdbcMapper.java
similarity index 91%
rename from querymapper/src/main/java/com/moparisthebest/jdbc/codegen/JdbcMapper.java
rename to common/src/main/java/com/moparisthebest/jdbc/codegen/JdbcMapper.java
index 1d07d66..f8b7254 100644
--- a/querymapper/src/main/java/com/moparisthebest/jdbc/codegen/JdbcMapper.java
+++ b/common/src/main/java/com/moparisthebest/jdbc/codegen/JdbcMapper.java
@@ -1,8 +1,5 @@
package com.moparisthebest.jdbc.codegen;
-import com.moparisthebest.classgen.AbstractSQLParser;
-import com.moparisthebest.classgen.SQLParser;
-
import java.io.Closeable;
import java.lang.annotation.ElementType;
import java.lang.annotation.Retention;
@@ -30,7 +27,7 @@ public interface JdbcMapper extends Closeable {
boolean cachePreparedStatements() default true;
- Class extends SQLParser> sqlParser() default AbstractSQLParser.class;
+ Class extends SQLParser> sqlParser() default SQLParser.class;
}
@Retention(RetentionPolicy.SOURCE)
diff --git a/querymapper/src/main/java/com/moparisthebest/jdbc/codegen/JdbcMapperFactory.java b/common/src/main/java/com/moparisthebest/jdbc/codegen/JdbcMapperFactory.java
similarity index 100%
rename from querymapper/src/main/java/com/moparisthebest/jdbc/codegen/JdbcMapperFactory.java
rename to common/src/main/java/com/moparisthebest/jdbc/codegen/JdbcMapperFactory.java
diff --git a/querymapper/src/main/java/com/moparisthebest/classgen/SQLParser.java b/common/src/main/java/com/moparisthebest/jdbc/codegen/SQLParser.java
similarity index 93%
rename from querymapper/src/main/java/com/moparisthebest/classgen/SQLParser.java
rename to common/src/main/java/com/moparisthebest/jdbc/codegen/SQLParser.java
index 9c2b20c..8960877 100644
--- a/querymapper/src/main/java/com/moparisthebest/classgen/SQLParser.java
+++ b/common/src/main/java/com/moparisthebest/jdbc/codegen/SQLParser.java
@@ -1,4 +1,4 @@
-package com.moparisthebest.classgen;
+package com.moparisthebest.jdbc.codegen;
/**
* Created by mopar on 5/25/17.
diff --git a/querymapper/src/main/java/com/moparisthebest/jdbc/util/ResultSetUtil.java b/common/src/main/java/com/moparisthebest/jdbc/util/ResultSetUtil.java
similarity index 85%
rename from querymapper/src/main/java/com/moparisthebest/jdbc/util/ResultSetUtil.java
rename to common/src/main/java/com/moparisthebest/jdbc/util/ResultSetUtil.java
index 4a8b283..2ae780c 100644
--- a/querymapper/src/main/java/com/moparisthebest/jdbc/util/ResultSetUtil.java
+++ b/common/src/main/java/com/moparisthebest/jdbc/util/ResultSetUtil.java
@@ -1,21 +1,19 @@
package com.moparisthebest.jdbc.util;
-import com.moparisthebest.jdbc.MapperException;
-
import java.sql.ResultSet;
import java.sql.SQLException;
import java.sql.Time;
import java.sql.Timestamp;
import java.util.Calendar;
-import static com.moparisthebest.jdbc.UpdateableDTO.NO;
-import static com.moparisthebest.jdbc.UpdateableDTO.YES;
-
/**
* Created by mopar on 5/16/17.
*/
public class ResultSetUtil {
+ public static final String YES = System.getProperty("UpdateableDTO.YES", "Y");
+ public static final String NO = System.getProperty("UpdateableDTO.NO", "N");
+
public static Integer getObjectInt(final ResultSet rs, final int index) throws SQLException {
final int ret = rs.getInt(index);
return rs.wasNull() ? null : ret;
@@ -59,7 +57,7 @@ public class ResultSetUtil {
final String bool = rs.getString(index);//.toUpperCase(); // do we want it case-insensitive?
final boolean ret = YES.equals(bool);
if (!ret && !NO.equals(bool))
- throw new MapperException(String.format("Implicit conversion of database string to boolean failed on column '%d'. Returned string needs to be 'Y' or 'N' and was instead '%s'.", index, bool));
+ throw new SQLException(String.format("Implicit conversion of database string to boolean failed on column '%d'. Returned string needs to be '%s' or '%s' and was instead '%s'.", index, YES, NO, bool));
return ret;
}
}
@@ -67,7 +65,7 @@ public class ResultSetUtil {
public static boolean getBooleanYN(final ResultSet rs, final int index) throws SQLException {
final Boolean ret = getObjectBooleanYN(rs, index);
if(ret == null)
- throw new MapperException(String.format("Implicit conversion of database string to boolean failed on column '%d'. Returned string needs to be 'Y' or 'N' and was instead 'null'. If you want to accept null values, make it an object Boolean instead of primitive boolean.", index));
+ throw new SQLException(String.format("Implicit conversion of database string to boolean failed on column '%d'. Returned string needs to be '%s' or '%s' and was instead 'null'. If you want to accept null values, make it an object Boolean instead of primitive boolean.", index, YES, NO));
return ret;
}
diff --git a/jdbcmapper/pom.xml b/jdbcmapper/pom.xml
new file mode 100644
index 0000000..f803382
--- /dev/null
+++ b/jdbcmapper/pom.xml
@@ -0,0 +1,71 @@
+
+
+ 4.0.0
+
+ com.moparisthebest.jdbcmapper
+ jdbcmapper-parent
+ 1.0-SNAPSHOT
+
+ jdbcmapper
+ ${project.artifactId}
+
+
+ ${project.groupId}
+ common
+ ${project.version}
+
+
+ ${project.groupId}
+ querymapper
+ ${project.version}
+
+
+ ${project.groupId}
+ querymapper
+ ${project.version}
+ test-jar
+ test
+
+
+ junit
+ junit
+ test
+
+
+ org.apache.derby
+ derby
+ test
+ true
+
+
+
+ ${project.artifactId}
+
+
+
+ maven-compiler-plugin
+ 3.1
+
+
+ 1.6
+ true
+
+
+
+
+ my-testCompile
+ test-compile
+
+ testCompile
+
+
+
+ com.moparisthebest.jdbc.codegen.JdbcMapperProcessor
+
+
+
+
+
+
+
+
diff --git a/querymapper/src/main/java/com/moparisthebest/classgen/AbstractSQLParser.java b/jdbcmapper/src/main/java/com/moparisthebest/jdbc/codegen/AbstractSQLParser.java
similarity index 83%
rename from querymapper/src/main/java/com/moparisthebest/classgen/AbstractSQLParser.java
rename to jdbcmapper/src/main/java/com/moparisthebest/jdbc/codegen/AbstractSQLParser.java
index a22faf3..b492d1b 100644
--- a/querymapper/src/main/java/com/moparisthebest/classgen/AbstractSQLParser.java
+++ b/jdbcmapper/src/main/java/com/moparisthebest/jdbc/codegen/AbstractSQLParser.java
@@ -1,4 +1,6 @@
-package com.moparisthebest.classgen;
+package com.moparisthebest.jdbc.codegen;
+
+import com.moparisthebest.jdbc.codegen.SQLParser;
/**
* Created by mopar on 5/25/17.
diff --git a/querymapper/src/main/java/com/moparisthebest/jdbc/codegen/CompileTimeResultSetMapper.java b/jdbcmapper/src/main/java/com/moparisthebest/jdbc/codegen/CompileTimeResultSetMapper.java
similarity index 100%
rename from querymapper/src/main/java/com/moparisthebest/jdbc/codegen/CompileTimeResultSetMapper.java
rename to jdbcmapper/src/main/java/com/moparisthebest/jdbc/codegen/CompileTimeResultSetMapper.java
diff --git a/querymapper/src/main/java/com/moparisthebest/jdbc/codegen/JdbcMapperProcessor.java b/jdbcmapper/src/main/java/com/moparisthebest/jdbc/codegen/JdbcMapperProcessor.java
similarity index 99%
rename from querymapper/src/main/java/com/moparisthebest/jdbc/codegen/JdbcMapperProcessor.java
rename to jdbcmapper/src/main/java/com/moparisthebest/jdbc/codegen/JdbcMapperProcessor.java
index 91fa36c..f3f70c1 100644
--- a/querymapper/src/main/java/com/moparisthebest/jdbc/codegen/JdbcMapperProcessor.java
+++ b/jdbcmapper/src/main/java/com/moparisthebest/jdbc/codegen/JdbcMapperProcessor.java
@@ -1,8 +1,5 @@
package com.moparisthebest.jdbc.codegen;
-import com.moparisthebest.classgen.SQLParser;
-import com.moparisthebest.classgen.SimpleSQLParser;
-
import javax.annotation.processing.*;
import javax.lang.model.SourceVersion;
import javax.lang.model.element.*;
diff --git a/querymapper/src/main/java/com/moparisthebest/classgen/SimpleSQLParser.java b/jdbcmapper/src/main/java/com/moparisthebest/jdbc/codegen/SimpleSQLParser.java
similarity index 96%
rename from querymapper/src/main/java/com/moparisthebest/classgen/SimpleSQLParser.java
rename to jdbcmapper/src/main/java/com/moparisthebest/jdbc/codegen/SimpleSQLParser.java
index 6fc6ee4..0837ee6 100644
--- a/querymapper/src/main/java/com/moparisthebest/classgen/SimpleSQLParser.java
+++ b/jdbcmapper/src/main/java/com/moparisthebest/jdbc/codegen/SimpleSQLParser.java
@@ -1,4 +1,4 @@
-package com.moparisthebest.classgen;
+package com.moparisthebest.jdbc.codegen;
import java.util.regex.Pattern;
diff --git a/querymapper/src/test/java/com/moparisthebest/jdbc/codegen/JdbcMapperTest.java b/jdbcmapper/src/test/java/com/moparisthebest/jdbc/codegen/JdbcMapperTest.java
similarity index 100%
rename from querymapper/src/test/java/com/moparisthebest/jdbc/codegen/JdbcMapperTest.java
rename to jdbcmapper/src/test/java/com/moparisthebest/jdbc/codegen/JdbcMapperTest.java
diff --git a/querymapper/src/test/java/com/moparisthebest/jdbc/codegen/PersonDAO.java b/jdbcmapper/src/test/java/com/moparisthebest/jdbc/codegen/PersonDAO.java
similarity index 100%
rename from querymapper/src/test/java/com/moparisthebest/jdbc/codegen/PersonDAO.java
rename to jdbcmapper/src/test/java/com/moparisthebest/jdbc/codegen/PersonDAO.java
diff --git a/querymapper/src/test/java/com/moparisthebest/jdbc/codegen/SqlParserTest.java b/jdbcmapper/src/test/java/com/moparisthebest/jdbc/codegen/SqlParserTest.java
similarity index 92%
rename from querymapper/src/test/java/com/moparisthebest/jdbc/codegen/SqlParserTest.java
rename to jdbcmapper/src/test/java/com/moparisthebest/jdbc/codegen/SqlParserTest.java
index dc5d12b..e04bce9 100644
--- a/querymapper/src/test/java/com/moparisthebest/jdbc/codegen/SqlParserTest.java
+++ b/jdbcmapper/src/test/java/com/moparisthebest/jdbc/codegen/SqlParserTest.java
@@ -1,7 +1,5 @@
package com.moparisthebest.jdbc.codegen;
-import com.moparisthebest.classgen.SQLParser;
-import com.moparisthebest.classgen.SimpleSQLParser;
import org.junit.Test;
import static org.junit.Assert.*;
diff --git a/pom.xml b/pom.xml
index 8aa3b1e..07849fe 100644
--- a/pom.xml
+++ b/pom.xml
@@ -65,7 +65,10 @@
pom
+ common
+ runtime-compiler
querymapper
+ jdbcmapper
diff --git a/querymapper/pom.xml b/querymapper/pom.xml
index 463deff..28c40a1 100644
--- a/querymapper/pom.xml
+++ b/querymapper/pom.xml
@@ -8,11 +8,17 @@
querymapper
${project.artifactId}
-
- false
- false
-
+
+ ${project.groupId}
+ common
+ ${project.version}
+
+
+ ${project.groupId}
+ runtime-compiler
+ ${project.version}
+
junit
junit
@@ -27,31 +33,21 @@
${project.artifactId}
-
- maven-compiler-plugin
- 3.1
-
-
- 1.6
- true
-
-
+ maven-jar-plugin
+ 2.2
- my-testCompile
- test-compile
- testCompile
+ test-jar
-
-
- com.moparisthebest.jdbc.codegen.JdbcMapperProcessor
-
-
+ test-compile
+
+ ${basedir}/target
+
diff --git a/runtime-compiler/pom.xml b/runtime-compiler/pom.xml
new file mode 100644
index 0000000..d9c9c4c
--- /dev/null
+++ b/runtime-compiler/pom.xml
@@ -0,0 +1,25 @@
+
+
+ 4.0.0
+
+ com.moparisthebest.jdbcmapper
+ jdbcmapper-parent
+ 1.0-SNAPSHOT
+
+ runtime-compiler
+ ${project.artifactId}
+
+ false
+ false
+
+
+
+ junit
+ junit
+ test
+
+
+
+ ${project.artifactId}
+
+
diff --git a/querymapper/src/main/java/com/moparisthebest/classgen/Compiler.java b/runtime-compiler/src/main/java/com/moparisthebest/classgen/Compiler.java
similarity index 100%
rename from querymapper/src/main/java/com/moparisthebest/classgen/Compiler.java
rename to runtime-compiler/src/main/java/com/moparisthebest/classgen/Compiler.java
diff --git a/querymapper/src/main/java/com/moparisthebest/classgen/MultiCompiler.java b/runtime-compiler/src/main/java/com/moparisthebest/classgen/MultiCompiler.java
similarity index 100%
rename from querymapper/src/main/java/com/moparisthebest/classgen/MultiCompiler.java
rename to runtime-compiler/src/main/java/com/moparisthebest/classgen/MultiCompiler.java
diff --git a/querymapper/src/main/java/com/moparisthebest/classgen/StringJavaFileObject.java b/runtime-compiler/src/main/java/com/moparisthebest/classgen/StringJavaFileObject.java
similarity index 100%
rename from querymapper/src/main/java/com/moparisthebest/classgen/StringJavaFileObject.java
rename to runtime-compiler/src/main/java/com/moparisthebest/classgen/StringJavaFileObject.java
diff --git a/querymapper/src/test/java/com/moparisthebest/classgentest/Calculator.java b/runtime-compiler/src/test/java/com/moparisthebest/classgentest/Calculator.java
similarity index 100%
rename from querymapper/src/test/java/com/moparisthebest/classgentest/Calculator.java
rename to runtime-compiler/src/test/java/com/moparisthebest/classgentest/Calculator.java
diff --git a/querymapper/src/test/java/com/moparisthebest/classgentest/CalculatorCompiler.java b/runtime-compiler/src/test/java/com/moparisthebest/classgentest/CompilerTest.java
similarity index 99%
rename from querymapper/src/test/java/com/moparisthebest/classgentest/CalculatorCompiler.java
rename to runtime-compiler/src/test/java/com/moparisthebest/classgentest/CompilerTest.java
index df9fd0a..0b6bc96 100644
--- a/querymapper/src/test/java/com/moparisthebest/classgentest/CalculatorCompiler.java
+++ b/runtime-compiler/src/test/java/com/moparisthebest/classgentest/CompilerTest.java
@@ -23,7 +23,7 @@ import static org.junit.Assert.assertEquals;
*
* @author moparisthebest
*/
-public class CalculatorCompiler {
+public class CompilerTest {
@Test
public void testSingle() throws InterruptedException {