Browse Source

Split into modules

pull/2/head
Travis Burtrum 5 years ago
parent
commit
849a85f1be
  1. 27
      common/pom.xml
  2. 0
      common/src/main/java/com/moparisthebest/jdbc/Cleaner.java
  3. 0
      common/src/main/java/com/moparisthebest/jdbc/Finishable.java
  4. 0
      common/src/main/java/com/moparisthebest/jdbc/TryClose.java
  5. 5
      common/src/main/java/com/moparisthebest/jdbc/codegen/JdbcMapper.java
  6. 0
      common/src/main/java/com/moparisthebest/jdbc/codegen/JdbcMapperFactory.java
  7. 2
      common/src/main/java/com/moparisthebest/jdbc/codegen/SQLParser.java
  8. 12
      common/src/main/java/com/moparisthebest/jdbc/util/ResultSetUtil.java
  9. 71
      jdbcmapper/pom.xml
  10. 4
      jdbcmapper/src/main/java/com/moparisthebest/jdbc/codegen/AbstractSQLParser.java
  11. 0
      jdbcmapper/src/main/java/com/moparisthebest/jdbc/codegen/CompileTimeResultSetMapper.java
  12. 3
      jdbcmapper/src/main/java/com/moparisthebest/jdbc/codegen/JdbcMapperProcessor.java
  13. 2
      jdbcmapper/src/main/java/com/moparisthebest/jdbc/codegen/SimpleSQLParser.java
  14. 0
      jdbcmapper/src/test/java/com/moparisthebest/jdbc/codegen/JdbcMapperTest.java
  15. 0
      jdbcmapper/src/test/java/com/moparisthebest/jdbc/codegen/PersonDAO.java
  16. 2
      jdbcmapper/src/test/java/com/moparisthebest/jdbc/codegen/SqlParserTest.java
  17. 3
      pom.xml
  18. 38
      querymapper/pom.xml
  19. 25
      runtime-compiler/pom.xml
  20. 0
      runtime-compiler/src/main/java/com/moparisthebest/classgen/Compiler.java
  21. 0
      runtime-compiler/src/main/java/com/moparisthebest/classgen/MultiCompiler.java
  22. 0
      runtime-compiler/src/main/java/com/moparisthebest/classgen/StringJavaFileObject.java
  23. 0
      runtime-compiler/src/test/java/com/moparisthebest/classgentest/Calculator.java
  24. 2
      runtime-compiler/src/test/java/com/moparisthebest/classgentest/CompilerTest.java

27
common/pom.xml

@ -0,0 +1,27 @@ @@ -0,0 +1,27 @@
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<parent>
<groupId>com.moparisthebest.jdbcmapper</groupId>
<artifactId>jdbcmapper-parent</artifactId>
<version>1.0-SNAPSHOT</version>
</parent>
<artifactId>common</artifactId>
<name>${project.artifactId}</name>
<dependencies>
<dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.apache.derby</groupId>
<artifactId>derby</artifactId>
<scope>test</scope>
<optional>true</optional>
</dependency>
</dependencies>
<build>
<finalName>${project.artifactId}</finalName>
</build>
</project>

0
querymapper/src/main/java/com/moparisthebest/jdbc/Cleaner.java → common/src/main/java/com/moparisthebest/jdbc/Cleaner.java

0
querymapper/src/main/java/com/moparisthebest/jdbc/Finishable.java → common/src/main/java/com/moparisthebest/jdbc/Finishable.java

0
querymapper/src/main/java/com/moparisthebest/jdbc/TryClose.java → common/src/main/java/com/moparisthebest/jdbc/TryClose.java

5
querymapper/src/main/java/com/moparisthebest/jdbc/codegen/JdbcMapper.java → common/src/main/java/com/moparisthebest/jdbc/codegen/JdbcMapper.java

@ -1,8 +1,5 @@ @@ -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 { @@ -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)

0
querymapper/src/main/java/com/moparisthebest/jdbc/codegen/JdbcMapperFactory.java → common/src/main/java/com/moparisthebest/jdbc/codegen/JdbcMapperFactory.java

2
querymapper/src/main/java/com/moparisthebest/classgen/SQLParser.java → common/src/main/java/com/moparisthebest/jdbc/codegen/SQLParser.java

@ -1,4 +1,4 @@ @@ -1,4 +1,4 @@
package com.moparisthebest.classgen;
package com.moparisthebest.jdbc.codegen;
/**
* Created by mopar on 5/25/17.

12
querymapper/src/main/java/com/moparisthebest/jdbc/util/ResultSetUtil.java → common/src/main/java/com/moparisthebest/jdbc/util/ResultSetUtil.java

@ -1,21 +1,19 @@ @@ -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 { @@ -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 { @@ -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;
}

71
jdbcmapper/pom.xml

@ -0,0 +1,71 @@ @@ -0,0 +1,71 @@
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<parent>
<groupId>com.moparisthebest.jdbcmapper</groupId>
<artifactId>jdbcmapper-parent</artifactId>
<version>1.0-SNAPSHOT</version>
</parent>
<artifactId>jdbcmapper</artifactId>
<name>${project.artifactId}</name>
<dependencies>
<dependency>
<groupId>${project.groupId}</groupId>
<artifactId>common</artifactId>
<version>${project.version}</version>
</dependency>
<dependency>
<groupId>${project.groupId}</groupId>
<artifactId>querymapper</artifactId>
<version>${project.version}</version>
</dependency>
<dependency>
<groupId>${project.groupId}</groupId>
<artifactId>querymapper</artifactId>
<version>${project.version}</version>
<type>test-jar</type>
<scope>test</scope>
</dependency>
<dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.apache.derby</groupId>
<artifactId>derby</artifactId>
<scope>test</scope>
<optional>true</optional>
</dependency>
</dependencies>
<build>
<finalName>${project.artifactId}</finalName>
<plugins>
<plugin>
<artifactId>maven-compiler-plugin</artifactId>
<version>3.1</version>
<configuration>
<source>1.6</source>
<target>1.6</target>
<debug>true</debug>
<!--compilerArgument>-Xlint:unchecked</compilerArgument-->
</configuration>
<executions>
<execution>
<id>my-testCompile</id>
<phase>test-compile</phase>
<goals>
<goal>testCompile</goal>
</goals>
<configuration>
<annotationProcessors>
<annotationProcessor>com.moparisthebest.jdbc.codegen.JdbcMapperProcessor</annotationProcessor>
</annotationProcessors>
</configuration>
</execution>
</executions>
</plugin>
</plugins>
</build>
</project>

4
querymapper/src/main/java/com/moparisthebest/classgen/AbstractSQLParser.java → jdbcmapper/src/main/java/com/moparisthebest/jdbc/codegen/AbstractSQLParser.java

@ -1,4 +1,6 @@ @@ -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.

0
querymapper/src/main/java/com/moparisthebest/jdbc/codegen/CompileTimeResultSetMapper.java → jdbcmapper/src/main/java/com/moparisthebest/jdbc/codegen/CompileTimeResultSetMapper.java

3
querymapper/src/main/java/com/moparisthebest/jdbc/codegen/JdbcMapperProcessor.java → jdbcmapper/src/main/java/com/moparisthebest/jdbc/codegen/JdbcMapperProcessor.java

@ -1,8 +1,5 @@ @@ -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.*;

2
querymapper/src/main/java/com/moparisthebest/classgen/SimpleSQLParser.java → jdbcmapper/src/main/java/com/moparisthebest/jdbc/codegen/SimpleSQLParser.java

@ -1,4 +1,4 @@ @@ -1,4 +1,4 @@
package com.moparisthebest.classgen;
package com.moparisthebest.jdbc.codegen;
import java.util.regex.Pattern;

0
querymapper/src/test/java/com/moparisthebest/jdbc/codegen/JdbcMapperTest.java → jdbcmapper/src/test/java/com/moparisthebest/jdbc/codegen/JdbcMapperTest.java

0
querymapper/src/test/java/com/moparisthebest/jdbc/codegen/PersonDAO.java → jdbcmapper/src/test/java/com/moparisthebest/jdbc/codegen/PersonDAO.java

2
querymapper/src/test/java/com/moparisthebest/jdbc/codegen/SqlParserTest.java → jdbcmapper/src/test/java/com/moparisthebest/jdbc/codegen/SqlParserTest.java

@ -1,7 +1,5 @@ @@ -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.*;

3
pom.xml

@ -65,7 +65,10 @@ @@ -65,7 +65,10 @@
</properties>
<packaging>pom</packaging>
<modules>
<module>common</module>
<module>runtime-compiler</module>
<module>querymapper</module>
<module>jdbcmapper</module>
</modules>
<dependencyManagement>
<dependencies>

38
querymapper/pom.xml

@ -8,11 +8,17 @@ @@ -8,11 +8,17 @@
</parent>
<artifactId>querymapper</artifactId>
<name>${project.artifactId}</name>
<properties>
<maven.test.skip>false</maven.test.skip>
<maven.test.failure.ignore>false</maven.test.failure.ignore>
</properties>
<dependencies>
<dependency>
<groupId>${project.groupId}</groupId>
<artifactId>common</artifactId>
<version>${project.version}</version>
</dependency>
<dependency>
<groupId>${project.groupId}</groupId>
<artifactId>runtime-compiler</artifactId>
<version>${project.version}</version>
</dependency>
<dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
@ -27,31 +33,21 @@ @@ -27,31 +33,21 @@
</dependencies>
<build>
<finalName>${project.artifactId}</finalName>
<plugins>
<plugin>
<artifactId>maven-compiler-plugin</artifactId>
<version>3.1</version>
<configuration>
<source>1.6</source>
<target>1.6</target>
<debug>true</debug>
<!--compilerArgument>-Xlint:unchecked</compilerArgument-->
</configuration>
<artifactId>maven-jar-plugin</artifactId>
<version>2.2</version>
<executions>
<execution>
<id>my-testCompile</id>
<phase>test-compile</phase>
<goals>
<goal>testCompile</goal>
<goal>test-jar</goal>
</goals>
<configuration>
<annotationProcessors>
<annotationProcessor>com.moparisthebest.jdbc.codegen.JdbcMapperProcessor</annotationProcessor>
</annotationProcessors>
</configuration>
<phase>test-compile</phase>
</execution>
</executions>
<configuration>
<outputDirectory>${basedir}/target</outputDirectory>
</configuration>
</plugin>
</plugins>
</build>

25
runtime-compiler/pom.xml

@ -0,0 +1,25 @@ @@ -0,0 +1,25 @@
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<parent>
<groupId>com.moparisthebest.jdbcmapper</groupId>
<artifactId>jdbcmapper-parent</artifactId>
<version>1.0-SNAPSHOT</version>
</parent>
<artifactId>runtime-compiler</artifactId>
<name>${project.artifactId}</name>
<properties>
<maven.test.skip>false</maven.test.skip>
<maven.test.failure.ignore>false</maven.test.failure.ignore>
</properties>
<dependencies>
<dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
<scope>test</scope>
</dependency>
</dependencies>
<build>
<finalName>${project.artifactId}</finalName>
</build>
</project>

0
querymapper/src/main/java/com/moparisthebest/classgen/Compiler.java → runtime-compiler/src/main/java/com/moparisthebest/classgen/Compiler.java

0
querymapper/src/main/java/com/moparisthebest/classgen/MultiCompiler.java → runtime-compiler/src/main/java/com/moparisthebest/classgen/MultiCompiler.java

0
querymapper/src/main/java/com/moparisthebest/classgen/StringJavaFileObject.java → runtime-compiler/src/main/java/com/moparisthebest/classgen/StringJavaFileObject.java

0
querymapper/src/test/java/com/moparisthebest/classgentest/Calculator.java → runtime-compiler/src/test/java/com/moparisthebest/classgentest/Calculator.java

2
querymapper/src/test/java/com/moparisthebest/classgentest/CalculatorCompiler.java → runtime-compiler/src/test/java/com/moparisthebest/classgentest/CompilerTest.java

@ -23,7 +23,7 @@ import static org.junit.Assert.assertEquals; @@ -23,7 +23,7 @@ import static org.junit.Assert.assertEquals;
*
* @author moparisthebest
*/
public class CalculatorCompiler {
public class CompilerTest {
@Test
public void testSingle() throws InterruptedException {
Loading…
Cancel
Save