mirror of
https://github.com/moparisthebest/JdbcMapper
synced 2024-11-21 08:35:00 -05:00
Split into modules
This commit is contained in:
parent
59cf4ff2cd
commit
849a85f1be
27
common/pom.xml
Normal file
27
common/pom.xml
Normal file
@ -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>
|
@ -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)
|
@ -1,4 +1,4 @@
|
||||
package com.moparisthebest.classgen;
|
||||
package com.moparisthebest.jdbc.codegen;
|
||||
|
||||
/**
|
||||
* Created by mopar on 5/25/17.
|
@ -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;
|
||||
}
|
||||
|
71
jdbcmapper/pom.xml
Normal file
71
jdbcmapper/pom.xml
Normal file
@ -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>
|
@ -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.
|
@ -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.*;
|
@ -1,4 +1,4 @@
|
||||
package com.moparisthebest.classgen;
|
||||
package com.moparisthebest.jdbc.codegen;
|
||||
|
||||
import java.util.regex.Pattern;
|
||||
|
@ -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
3
pom.xml
@ -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>
|
||||
|
@ -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 @@
|
||||
</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
Normal file
25
runtime-compiler/pom.xml
Normal file
@ -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>
|
@ -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…
Reference in New Issue
Block a user