mirror of
https://github.com/querydsl/querydsl.git
synced 2026-06-30 21:08:30 +08:00
improved handling of enum types
This commit is contained in:
parent
841b665fa0
commit
c5aa29f90e
@ -223,14 +223,14 @@ public class APTTypeModelFactory implements TypeVisitor<TypeModel,Elements> {
|
||||
if (t.asElement() != null && t.asElement() instanceof TypeElement){
|
||||
TypeElement typeElement = (TypeElement)t.asElement();
|
||||
switch(typeElement.getKind()){
|
||||
case ENUM:
|
||||
case CLASS: return createClassType(t, typeElement, p);
|
||||
case INTERFACE: return createInterfaceType(t, typeElement, p);
|
||||
case ENUM: return create(typeElement, TypeCategory.SIMPLE, p, t.getTypeArguments());
|
||||
default: throw new IllegalArgumentException("Illegal type " + typeElement);
|
||||
}
|
||||
}else{
|
||||
throw new IllegalArgumentException("Unsupported element type " + t.asElement());
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
private TypeModel createInterfaceType(DeclaredType t, TypeElement typeElement, Elements p) {
|
||||
|
||||
@ -185,8 +185,7 @@ public final class EntityElementVisitor extends SimpleElementVisitor6<EntityMode
|
||||
|
||||
}else if (configuration.isBlockedField(field)){
|
||||
blockedProperties.add(name);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
@ -0,0 +1,19 @@
|
||||
package com.mysema.query.domain;
|
||||
|
||||
import org.junit.Test;
|
||||
|
||||
import com.mysema.query.annotations.QueryEntity;
|
||||
|
||||
public class LiteralEntityTest {
|
||||
|
||||
@QueryEntity
|
||||
enum EnumEntity{
|
||||
|
||||
}
|
||||
|
||||
@Test
|
||||
public void test(){
|
||||
// TODO
|
||||
}
|
||||
|
||||
}
|
||||
@ -13,10 +13,10 @@ import org.junit.Test;
|
||||
import com.mysema.query.annotations.QueryEntity;
|
||||
import com.mysema.query.domain.rel.RelationType2;
|
||||
import com.mysema.query.types.path.PCollection;
|
||||
import com.mysema.query.types.path.PComparable;
|
||||
import com.mysema.query.types.path.PList;
|
||||
import com.mysema.query.types.path.PMap;
|
||||
import com.mysema.query.types.path.PSet;
|
||||
import com.mysema.query.types.path.PSimple;
|
||||
|
||||
public class RelationTest extends AbstractTest{
|
||||
|
||||
@ -101,7 +101,7 @@ public class RelationTest extends AbstractTest{
|
||||
@Test
|
||||
public void test() throws SecurityException, NoSuchFieldException{
|
||||
cl = QRelationType.class;
|
||||
match(PSimple.class, "enumProperty");
|
||||
match(PComparable.class, "enumProperty");
|
||||
match(PList.class, "enumList");
|
||||
match(PMap.class, "enumMap1");
|
||||
match(PMap.class, "enumMap");
|
||||
|
||||
Loading…
Reference in New Issue
Block a user