fixed Embeddable handing issue

This commit is contained in:
Timo Westkämper 2009-11-14 08:50:17 +00:00
parent 8939227b58
commit 95487c9751
4 changed files with 58 additions and 5 deletions

View File

@ -75,8 +75,10 @@ public class Processor {
// populate super type mappings
if (conf.getSuperTypeAnn() != null) {
for (Element element : roundEnv.getElementsAnnotatedWith(conf.getSuperTypeAnn())) {
BeanModel model = element.accept(entityVisitor, null);
superTypes.put(model.getName(), model);
if (conf.getEmbeddableAnn() == null || element.getAnnotation(conf.getEmbeddableAnn()) == null){
BeanModel model = element.accept(entityVisitor, null);
superTypes.put(model.getName(), model);
}
}
// add supertype fields
for (BeanModel superType : superTypes.values()) {
@ -93,8 +95,10 @@ public class Processor {
// populate entity type mappings
Map<String, BeanModel> entityTypes = new HashMap<String, BeanModel>();
for (Element element : roundEnv.getElementsAnnotatedWith(conf.getEntityAnn())) {
BeanModel model = element.accept(entityVisitor, null);
entityTypes.put(model.getName(), model);
if (conf.getEmbeddableAnn() == null || element.getAnnotation(conf.getEmbeddableAnn()) == null){
BeanModel model = element.accept(entityVisitor, null);
entityTypes.put(model.getName(), model);
}
}
superTypes.putAll(entityTypes);

View File

@ -38,7 +38,6 @@ public class QuerydslAnnotationProcessor extends AbstractProcessor{
entity = QueryEntity.class;
superType = QuerySupertype.class;
embeddable = QueryEmbeddable.class;
// dto = QueryProjection.class;
skip = QueryTransient.class;
SimpleConfiguration configuration = new SimpleConfiguration(entity, superType, embeddable, skip);

View File

@ -6,6 +6,7 @@ import org.junit.Test;
import com.mysema.query.annotations.QueryEmbeddable;
import com.mysema.query.annotations.QueryEntity;
import com.mysema.query.annotations.QuerySupertype;
import com.mysema.query.domain.AnimalTest.Cat;
public class EmbeddableTest {
@ -51,6 +52,18 @@ public class EmbeddableTest {
}
@QueryEntity
@QueryEmbeddable
public static class EntityAndEmbeddable{
}
@QuerySupertype
@QueryEmbeddable
public static class SuperclassAndEmbeddable{
}
@Test
public void test(){

View File

@ -29,6 +29,43 @@ public class InheritanceTest {
}
@QueryEntity
public abstract class BobbinGenOperation<M extends FlexPlasticFilm> extends Operation<M>{
}
@QueryEntity
public abstract class Operation<M extends Merchandise> extends Entity{
}
@QueryEntity
public abstract class FlexPlasticFilm extends FlexPlastic implements Rimmable{
}
@QueryEntity
public abstract class FlexPlastic extends Storable{
}
public abstract class Storable extends Merchandise{
}
@QueryEntity
public abstract class Merchandise extends Entity implements UnitConversionSupporter{
}
public interface Rimmable{
}
public interface UnitConversionSupporter{
}
@Test
public void test(){
// TODO