From 6825176babf49003209b80dcf2cae53b6fc53778 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Timo=20Westk=C3=A4mper?= Date: Mon, 4 Jul 2011 13:43:32 +0000 Subject: [PATCH] --- .../java/com/mysema/query/apt/Processor.java | 20 ++++++++++++-- .../query/domain/EmbeddableDeepTest.java | 27 +++++++++++++++++++ querydsl-apt/template.mf | 4 ++- 3 files changed, 48 insertions(+), 3 deletions(-) diff --git a/querydsl-apt/src/main/java/com/mysema/query/apt/Processor.java b/querydsl-apt/src/main/java/com/mysema/query/apt/Processor.java index 28d7e4af3..30612cd68 100644 --- a/querydsl-apt/src/main/java/com/mysema/query/apt/Processor.java +++ b/querydsl-apt/src/main/java/com/mysema/query/apt/Processor.java @@ -440,7 +440,7 @@ public class Processor { Element superTypeElement = env.getTypeUtils().asElement(superTypeMirror); if (superTypeElement != null && !superTypeElement.toString().startsWith("java.lang.") - && superTypeElement.getAnnotationMirrors().isEmpty()) { + && !hasKnownAnnotation(superTypeElement)) { typeFactory.getEntityType(superTypeMirror, false); superTypeMirrors.add(superTypeMirror); elements.add(superTypeElement); @@ -470,6 +470,22 @@ public class Processor { mergeTypes(types, superTypes); } + + private boolean hasKnownAnnotation(Element element) { + if (configuration.getEmbeddableAnnotation() != null && element.getAnnotation(configuration.getEmbeddableAnnotation()) != null) { + return true; + } + + if (configuration.getSupertypeSerializer() != null && element.getAnnotation(configuration.getSuperTypeAnnotation()) != null) { + return true; + } + + if (element.getAnnotation(configuration.getEntityAnnotation()) != null) { + return true; + } + + return false; + } private void processDelegateMethod(Element delegateMethod, boolean cached) { ExecutableElement method = (ExecutableElement)delegateMethod; @@ -550,7 +566,7 @@ public class Processor { Element superTypeElement = env.getTypeUtils().asElement(superTypeMirror); if (superTypeElement != null && !superTypeElement.toString().startsWith("java.lang.") - && superTypeElement.getAnnotationMirrors().isEmpty()) { + && !hasKnownAnnotation(superTypeElement)) { typeFactory.getEntityType(superTypeMirror, false); superTypeMirrors.add(superTypeMirror); elements.add(superTypeElement); diff --git a/querydsl-apt/src/test/java/com/mysema/query/domain/EmbeddableDeepTest.java b/querydsl-apt/src/test/java/com/mysema/query/domain/EmbeddableDeepTest.java index aabbd40d0..178853171 100644 --- a/querydsl-apt/src/test/java/com/mysema/query/domain/EmbeddableDeepTest.java +++ b/querydsl-apt/src/test/java/com/mysema/query/domain/EmbeddableDeepTest.java @@ -27,6 +27,8 @@ public class EmbeddableDeepTest { } + // JPA + @Entity public class A extends AEntity { @@ -50,4 +52,29 @@ public class EmbeddableDeepTest { } + // plain + +// @QueryEntity +// public class AA extends AValueObject { +// +// @QueryEmbedded +// BB b; +// +// } +// +// @QueryEmbeddable +// public class BB extends AValueObject { +// +// @QueryEmbedded +// CC c; +// +// } +// +// @QueryEmbeddable +// public class CC extends AValueObject { +// +// SomeType someType; +// +// } + } diff --git a/querydsl-apt/template.mf b/querydsl-apt/template.mf index 48decc620..ccc332841 100644 --- a/querydsl-apt/template.mf +++ b/querydsl-apt/template.mf @@ -14,4 +14,6 @@ Import-Template: net.sf.cglib.proxy.*;version="${cglib.version}", org.apache.commons.collections15.*;version="${commons.collections.version}", org.apache.commons.lang.*;version="${commons.lang.version}" - \ No newline at end of file +Excluded-Imports: + edu.umd.cs.findbugs.annotations.*, + net.jcip.annotations.* \ No newline at end of file