-
-
Notifications
You must be signed in to change notification settings - Fork 71
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add support for handling multiple AnnotateWith (#697)
- Loading branch information
1 parent
9a6e5be
commit f0e6294
Showing
9 changed files
with
188 additions
and
41 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
28 changes: 28 additions & 0 deletions
28
...sor/src/test/java/org/seasar/doma/internal/apt/processor/dao/MultipleAnnotateWithDao.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
package org.seasar.doma.internal.apt.processor.dao; | ||
|
||
import org.seasar.doma.AnnotateWith; | ||
import org.seasar.doma.Annotation; | ||
import org.seasar.doma.AnnotationTarget; | ||
import org.seasar.doma.Dao; | ||
import org.seasar.doma.Insert; | ||
import org.seasar.doma.internal.apt.processor.entity.Emp; | ||
|
||
@Dao | ||
@MultipleAnnotationConfig1 | ||
@MultipleAnnotationConfig2 | ||
@AnnotateWith( | ||
annotations = { | ||
@Annotation( | ||
target = AnnotationTarget.CONSTRUCTOR_PARAMETER, | ||
type = ConstructorParameterAnnotation.class, | ||
elements = "aaa = 1, bbb = true"), | ||
@Annotation( | ||
target = AnnotationTarget.CONSTRUCTOR_PARAMETER, | ||
type = ConstructorParameterAnnotation2.class, | ||
elements = "aaa = 1, bbb = true") | ||
}) | ||
public interface MultipleAnnotateWithDao { | ||
|
||
@Insert | ||
int insert(Emp emp); | ||
} |
24 changes: 24 additions & 0 deletions
24
...r/src/test/java/org/seasar/doma/internal/apt/processor/dao/MultipleAnnotationConfig1.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
package org.seasar.doma.internal.apt.processor.dao; | ||
|
||
import java.lang.annotation.ElementType; | ||
import java.lang.annotation.Retention; | ||
import java.lang.annotation.RetentionPolicy; | ||
import java.lang.annotation.Target; | ||
import org.seasar.doma.AnnotateWith; | ||
import org.seasar.doma.Annotation; | ||
import org.seasar.doma.AnnotationTarget; | ||
|
||
@Target(ElementType.TYPE) | ||
@Retention(RetentionPolicy.RUNTIME) | ||
@AnnotateWith( | ||
annotations = { | ||
@Annotation( | ||
target = AnnotationTarget.CLASS, | ||
type = ClassAnnotation.class, | ||
elements = "aaa = 1, bbb = true"), | ||
@Annotation( | ||
target = AnnotationTarget.CLASS, | ||
type = ClassAnnotation2.class, | ||
elements = "aaa = 1, bbb = true"), | ||
}) | ||
public @interface MultipleAnnotationConfig1 {} |
24 changes: 24 additions & 0 deletions
24
...r/src/test/java/org/seasar/doma/internal/apt/processor/dao/MultipleAnnotationConfig2.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
package org.seasar.doma.internal.apt.processor.dao; | ||
|
||
import java.lang.annotation.ElementType; | ||
import java.lang.annotation.Retention; | ||
import java.lang.annotation.RetentionPolicy; | ||
import java.lang.annotation.Target; | ||
import org.seasar.doma.AnnotateWith; | ||
import org.seasar.doma.Annotation; | ||
import org.seasar.doma.AnnotationTarget; | ||
|
||
@Target(ElementType.TYPE) | ||
@Retention(RetentionPolicy.RUNTIME) | ||
@AnnotateWith( | ||
annotations = { | ||
@Annotation( | ||
target = AnnotationTarget.CONSTRUCTOR, | ||
type = ConstructorAnnotation.class, | ||
elements = "aaa = 1, bbb = true"), | ||
@Annotation( | ||
target = AnnotationTarget.CONSTRUCTOR, | ||
type = ConstructorAnnotation2.class, | ||
elements = "aaa = 1, bbb = true"), | ||
}) | ||
public @interface MultipleAnnotationConfig2 {} |
62 changes: 62 additions & 0 deletions
62
...s/org/seasar/doma/internal/apt/processor/dao/DaoProcessorTest_MultipleAnnotateWithDao.txt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,62 @@ | ||
package org.seasar.doma.internal.apt.processor.dao; | ||
|
||
/** */ | ||
@org.seasar.doma.internal.apt.processor.dao.ClassAnnotation(aaa = 1, bbb = true) | ||
@org.seasar.doma.internal.apt.processor.dao.ClassAnnotation2(aaa = 1, bbb = true) | ||
@javax.annotation.Generated(value = { "Doma", "@VERSION@" }, date = "1970-01-01T09:00:00.000+0900") | ||
@org.seasar.doma.DaoImplementation | ||
public class MultipleAnnotateWithDaoImpl implements org.seasar.doma.internal.apt.processor.dao.MultipleAnnotateWithDao, org.seasar.doma.jdbc.ConfigProvider { | ||
|
||
static { | ||
org.seasar.doma.internal.Artifact.validateVersion("@VERSION@"); | ||
} | ||
|
||
private static final java.lang.reflect.Method __method0 = org.seasar.doma.internal.jdbc.dao.DaoImplSupport.getDeclaredMethod(org.seasar.doma.internal.apt.processor.dao.MultipleAnnotateWithDao.class, "insert", org.seasar.doma.internal.apt.processor.entity.Emp.class); | ||
|
||
private final org.seasar.doma.internal.jdbc.dao.DaoImplSupport __support; | ||
|
||
/** | ||
* @param config the config | ||
*/ | ||
@org.seasar.doma.internal.apt.processor.dao.ConstructorAnnotation(aaa = 1, bbb = true) | ||
@org.seasar.doma.internal.apt.processor.dao.ConstructorAnnotation2(aaa = 1, bbb = true) | ||
public MultipleAnnotateWithDaoImpl(@org.seasar.doma.internal.apt.processor.dao.ConstructorParameterAnnotation(aaa = 1, bbb = true) @org.seasar.doma.internal.apt.processor.dao.ConstructorParameterAnnotation2(aaa = 1, bbb = true) org.seasar.doma.jdbc.Config config) { | ||
__support = new org.seasar.doma.internal.jdbc.dao.DaoImplSupport(config); | ||
} | ||
|
||
@Override | ||
public org.seasar.doma.jdbc.Config getConfig() { | ||
return __support.getConfig(); | ||
} | ||
|
||
@Override | ||
public int insert(org.seasar.doma.internal.apt.processor.entity.Emp emp) { | ||
__support.entering("org.seasar.doma.internal.apt.processor.dao.MultipleAnnotateWithDaoImpl", "insert", emp); | ||
try { | ||
if (emp == null) { | ||
throw new org.seasar.doma.DomaNullPointerException("emp"); | ||
} | ||
org.seasar.doma.jdbc.query.AutoInsertQuery<org.seasar.doma.internal.apt.processor.entity.Emp> __query = __support.getQueryImplementors().createAutoInsertQuery(__method0, org.seasar.doma.internal.apt.processor.entity._Emp.getSingletonInternal()); | ||
__query.setMethod(__method0); | ||
__query.setConfig(__support.getConfig()); | ||
__query.setEntity(emp); | ||
__query.setCallerClassName("org.seasar.doma.internal.apt.processor.dao.MultipleAnnotateWithDaoImpl"); | ||
__query.setCallerMethodName("insert"); | ||
__query.setQueryTimeout(-1); | ||
__query.setSqlLogType(org.seasar.doma.jdbc.SqlLogType.FORMATTED); | ||
__query.setNullExcluded(false); | ||
__query.setIncludedPropertyNames(); | ||
__query.setExcludedPropertyNames(); | ||
__query.prepare(); | ||
org.seasar.doma.jdbc.command.InsertCommand __command = __support.getCommandImplementors().createInsertCommand(__method0, __query); | ||
int __result = __command.execute(); | ||
__query.complete(); | ||
__support.exiting("org.seasar.doma.internal.apt.processor.dao.MultipleAnnotateWithDaoImpl", "insert", __result); | ||
return __result; | ||
} catch (java.lang.RuntimeException __e) { | ||
__support.throwing("org.seasar.doma.internal.apt.processor.dao.MultipleAnnotateWithDaoImpl", "insert", __e); | ||
throw __e; | ||
} | ||
} | ||
|
||
} |