use of com.querydsl.codegen.utils.model.TypeCategory in project querydsl by querydsl.
the class DefaultEmbeddableSerializer method introClassHeader.
@Override
@SuppressWarnings(UNCHECKED)
protected void introClassHeader(CodeWriter writer, EntityType model) throws IOException {
Type queryType = typeMappings.getPathType(model, model, true);
TypeCategory category = model.getOriginalCategory();
Class<? extends Path> pathType;
if (model.getProperties().isEmpty()) {
switch(category) {
case COMPARABLE:
pathType = ComparablePath.class;
break;
case ENUM:
pathType = EnumPath.class;
break;
case DATE:
pathType = DatePath.class;
break;
case DATETIME:
pathType = DateTimePath.class;
break;
case TIME:
pathType = TimePath.class;
break;
case NUMERIC:
pathType = NumberPath.class;
break;
case STRING:
pathType = StringPath.class;
break;
case BOOLEAN:
pathType = BooleanPath.class;
break;
default:
pathType = BeanPath.class;
}
} else {
pathType = BeanPath.class;
}
for (Annotation annotation : model.getAnnotations()) {
writer.annotation(annotation);
}
writer.line("@", generatedAnnotationClass.getSimpleName(), "(\"", getClass().getName(), "\")");
if (category == TypeCategory.BOOLEAN || category == TypeCategory.STRING) {
writer.beginClass(queryType, new ClassType(pathType));
} else {
writer.beginClass(queryType, new ClassType(category, pathType, model));
}
// TODO : generate proper serialVersionUID here
writer.privateStaticFinal(Types.LONG_P, "serialVersionUID", model.hashCode() + "L");
}
Aggregations