use of com.querydsl.codegen.utils.model.SimpleType in project querydsl by querydsl.
the class InnerClassesTest method DirectParameter.
@Test
public void DirectParameter() throws IOException {
Type entityType = new ClassType(Entity.class);
Type type = new SimpleType("com.querydsl.codegen.utils.gen.QEntity", "com.querydsl.codegen.utils.gen", "QEntity", entityType);
StringWriter str = new StringWriter();
JavaWriter writer = new JavaWriter(str);
writer.beginClass(type);
writer.end();
System.err.println(str.toString());
}
use of com.querydsl.codegen.utils.model.SimpleType in project querydsl by querydsl.
the class ScalaWriterTest method Arrays.
@Test
public void Arrays() throws IOException {
// def main(args: Array[String]) {
writer.beginClass(new SimpleType("Main"));
writer.field(Types.STRING.asArrayType(), "stringArray");
writer.beginPublicMethod(Types.VOID, "main", new Parameter("args", Types.STRING.asArrayType()));
writer.line("//");
writer.end();
writer.beginPublicMethod(Types.VOID, "main2", new Parameter("args", new ClassType(TypeCategory.ARRAY, String[].class)));
writer.line("//");
writer.end();
writer.end();
System.out.println(w);
assertTrue(w.toString().contains("var stringArray: Array[String]"));
assertTrue(w.toString().contains("def main(args: Array[String])"));
assertTrue(w.toString().contains("def main2(args: Array[String])"));
}
use of com.querydsl.codegen.utils.model.SimpleType in project querydsl by querydsl.
the class ScalaWriterTest method Trait.
@Test
public void Trait() throws IOException {
// trait MyTrait
writer.beginInterface(new SimpleType("MyTrait"));
writer.line("//");
writer.end();
System.out.println(w);
assertTrue(w.toString().contains("trait MyTrait"));
}
use of com.querydsl.codegen.utils.model.SimpleType 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.querydsl.codegen.utils.model.SimpleType in project querydsl by querydsl.
the class ExtendedBeanSerializerTest method setUp.
@Before
public void setUp() throws IOException {
Type typeModel = new SimpleType(TypeCategory.ENTITY, FULL_NAME, PACKAGE, CLASS_NAME, false, false);
type = new EntityType(typeModel);
File srcFolder = compileFolder.newFolder(PATH);
srcFile = new File(srcFolder, CLASS_NAME + ".java");
}
Aggregations