added hashCode implementation

This commit is contained in:
Timo Westkämper 2009-02-10 15:44:55 +00:00
parent 95671018bc
commit a0fb9610e4
2 changed files with 20 additions and 7 deletions

View File

@ -48,7 +48,15 @@ public class APTFactory implements AnnotationProcessorFactory {
Set<AnnotationTypeDeclaration> atds,
AnnotationProcessorEnvironment env) {
try {
return new GeneralProcessor(env, jpaSuperClass, jpaEntity, qdDto, jpaEmbeddable);
try {
// try JPA first
Class.forName(jpaSuperClass);
return new GeneralProcessor(env, jpaSuperClass, jpaEntity, qdDto, jpaEmbeddable);
} catch (ClassNotFoundException e) {
// try Querydsl specific next
return new GeneralProcessor(env, null, qdEntity, qdDto, null);
}
} catch (IOException e) {
String error = "Caught " + e.getClass().getName();
throw new RuntimeException(error, e);

View File

@ -78,12 +78,17 @@ public class GeneralProcessor implements AnnotationProcessor {
EntityVisitor superclassVisitor = new EntityVisitor();
// mapped superclass
AnnotationTypeDeclaration a = (AnnotationTypeDeclaration) env
.getTypeDeclaration(superClassAnnotation);
for (Declaration typeDecl : env.getDeclarationsAnnotatedWith(a)) {
typeDecl.accept(getDeclarationScanner(superclassVisitor, NO_OP));
}
Map<String, Type> mappedSupertypes = superclassVisitor.types;
AnnotationTypeDeclaration a;
Map<String, Type> mappedSupertypes;
if (superClassAnnotation != null){
a = (AnnotationTypeDeclaration) env.getTypeDeclaration(superClassAnnotation);
for (Declaration typeDecl : env.getDeclarationsAnnotatedWith(a)) {
typeDecl.accept(getDeclarationScanner(superclassVisitor, NO_OP));
}
mappedSupertypes = superclassVisitor.types;
}else{
mappedSupertypes = new HashMap<String,Type>();
}
// domain types
EntityVisitor entityVisitor = new EntityVisitor();