use of com.mysema.codegen.model.Type in project querydsl by querydsl.
the class Generic2Test method resolve2.
@Test
public void resolve2() {
TypeFactory factory = new TypeFactory(Collections.<Class<? extends Annotation>>emptyList());
Type type = factory.getEntityType(AbstractCollectionAttribute.class);
assertEquals("com.querydsl.codegen.Generic2Test.AbstractCollectionAttribute<? extends java.util.Collection<?>>", type.getGenericName(false));
assertEquals("com.querydsl.codegen.Generic2Test.AbstractCollectionAttribute<? extends java.util.Collection<?>>", type.getGenericName(true));
}
use of com.mysema.codegen.model.Type in project querydsl by querydsl.
the class Inheritance2Test method base_base.
@Test
public void base_base() throws SecurityException, NoSuchFieldException {
TypeFactory typeFactory = new TypeFactory();
Field field = Base.class.getDeclaredField("base");
Type type = typeFactory.get(field.getType(), field.getGenericType());
assertEquals(0, type.getParameters().size());
}
use of com.mysema.codegen.model.Type in project querydsl by querydsl.
the class Inheritance2Test method base_base2.
@Test
public void base_base2() throws SecurityException, NoSuchFieldException {
TypeFactory typeFactory = new TypeFactory();
Field field = Base.class.getDeclaredField("base2");
Type type = typeFactory.get(field.getType(), field.getGenericType());
assertEquals(2, type.getParameters().size());
assertNull(((TypeExtends) type.getParameters().get(0)).getVarName());
assertNull(((TypeExtends) type.getParameters().get(1)).getVarName());
}
use of com.mysema.codegen.model.Type in project querydsl by querydsl.
the class TypeResolver method resolveWithParameters.
private static Type resolveWithParameters(Type type, Type declaringType, EntityType context) {
Type[] params = new Type[type.getParameters().size()];
boolean transformed = false;
for (int i = 0; i < type.getParameters().size(); i++) {
Type param = type.getParameters().get(i);
if (param != null && !param.getFullName().equals(type.getFullName())) {
params[i] = resolve(param, declaringType, context);
if (!params[i].equals(param)) {
transformed = true;
}
}
}
if (transformed) {
return new SimpleType(type, params);
} else {
return type;
}
}
use of com.mysema.codegen.model.Type in project querydsl by querydsl.
the class PropertyTest method escapedName.
@Test
public void escapedName() {
Type typeModel = new SimpleType(TypeCategory.ENTITY, "com.querydsl.DomainClass", "com.querydsl", "DomainClass", false, false);
EntityType type = new EntityType(typeModel);
Property property = new Property(type, "boolean", type, Collections.<String>emptyList());
assertEquals("boolean$", property.getEscapedName());
}
Aggregations