use of com.querydsl.codegen.utils.model.SimpleType in project querydsl by querydsl.
the class BeanSerializerTest method setUp.
@Before
public void setUp() {
typeModel = new SimpleType(TypeCategory.ENTITY, "com.querydsl.DomainClass", "com.querydsl", "DomainClass", false, false);
type = new EntityType(typeModel);
}
use of com.querydsl.codegen.utils.model.SimpleType in project querydsl by querydsl.
the class TypeMappingsTest method testGenericTypeRegistration.
@Test
public void testGenericTypeRegistration() {
SimpleType rawListType = new SimpleType(List.class.getName());
SimpleType integerListType = new SimpleType(rawListType, Collections.<Type>singletonList(new SimpleType(Integer.class.getName())));
SimpleType longListType = new SimpleType(rawListType, Collections.<Type>singletonList(new SimpleType(Long.class.getName())));
SimpleType integerListTypeExpression = new SimpleType("integerListTypeExpression");
SimpleType longListTypeExpression = new SimpleType("longListTypeExpression");
TypeMappings typeMappings = new JavaTypeMappings();
typeMappings.register(integerListType, integerListTypeExpression);
typeMappings.register(longListType, longListTypeExpression);
assertEquals(integerListTypeExpression, typeMappings.getExprType(integerListType, null, false));
assertEquals(longListTypeExpression, typeMappings.getExprType(longListType, null, false));
}
use of com.querydsl.codegen.utils.model.SimpleType in project querydsl by querydsl.
the class PropertyTest method equals_and_hashCode.
@Test
public void equals_and_hashCode() {
Type typeModel = new SimpleType(TypeCategory.ENTITY, "com.querydsl.DomainClass", "com.querydsl", "DomainClass", false, false);
EntityType type = new EntityType(typeModel);
Property p1 = new Property(type, "property", type, Collections.<String>emptyList());
Property p2 = new Property(type, "property", type, Collections.<String>emptyList());
assertEquals(p1, p1);
assertEquals(p1, p2);
assertEquals(p1.hashCode(), p2.hashCode());
}
use of com.querydsl.codegen.utils.model.SimpleType in project querydsl by querydsl.
the class MetaDataTest method setUp.
@Before
public void setUp() {
NamingStrategy namingStrategy = new DefaultNamingStrategy();
String packageName = "com.myproject.domain";
String tableName = "vwServiceName";
String className = namingStrategy.getClassName(tableName);
Type classTypeModel = new SimpleType(TypeCategory.ENTITY, packageName + "." + className, packageName, className, false, false);
classModel = new EntityType(classTypeModel);
// classModel.addAnnotation(new TableImpl(namingStrategy.normalizeTableName(tableName)));
classModel.getData().put("table", namingStrategy.normalizeTableName(tableName));
}
use of com.querydsl.codegen.utils.model.SimpleType in project querydsl by querydsl.
the class ExtendedTypeFactory method createMapType.
protected Type createMapType(Iterator<? extends TypeMirror> typeMirrors, boolean deep) {
if (!typeMirrors.hasNext()) {
return new SimpleType(Types.MAP, defaultType, defaultType);
}
Type keyType = getType(typeMirrors.next(), deep);
if (keyType == null) {
keyType = defaultType;
}
Type valueType = getType(typeMirrors.next(), deep);
if (valueType == null) {
valueType = defaultType;
} else if (valueType.getParameters().isEmpty()) {
TypeElement element = env.getElementUtils().getTypeElement(valueType.getFullName());
if (element != null) {
Type type = getType(element.asType(), deep);
if (!type.getParameters().isEmpty()) {
valueType = new SimpleType(valueType, new Type[type.getParameters().size()]);
}
}
}
return new SimpleType(Types.MAP, keyType, valueType);
}
Aggregations