Examples of JavaWriter


Examples of com.mysema.codegen.JavaWriter

        Property property = new Property(type, "entityField", type);
        property.addAnnotation(new QueryEntityImpl());
        type.addProperty(property);

        BeanSerializer serializer = new BeanSerializer();
        serializer.serialize(type, SimpleSerializerConfig.DEFAULT, new JavaWriter(writer));
        String str = writer.toString();

        assertTrue(str.contains("import com.mysema.query.annotations.QueryEntity;"));
        assertTrue(str.contains("@QueryEntity"));
    }
View Full Code Here

Examples of com.mysema.codegen.JavaWriter

        Property property = new Property(type, "entityField", type);
        property.addAnnotation(new QueryEntityImpl());
        type.addProperty(property);

        BeanSerializer serializer = new BeanSerializer(false);
        serializer.serialize(type, SimpleSerializerConfig.DEFAULT, new JavaWriter(writer));
        String str = writer.toString();

        assertFalse(str.contains("import com.mysema.query.annotations.QueryEntity;"));
        assertFalse(str.contains("@QueryEntity"));
    }
View Full Code Here

Examples of com.mysema.codegen.JavaWriter

    public void Capitalization() throws IOException{
        // property
        type.addProperty(new Property(type, "cId", type));

        BeanSerializer serializer = new BeanSerializer();
        serializer.serialize(type, SimpleSerializerConfig.DEFAULT, new JavaWriter(writer));
        assertTrue(writer.toString().contains("public DomainClass getcId() {"));
    }
View Full Code Here

Examples of com.mysema.codegen.JavaWriter

    @Test
    public void Interfaces() throws IOException {
        BeanSerializer serializer = new BeanSerializer();
        serializer.addInterface(new ClassType(Serializable.class));
        serializer.serialize(type, SimpleSerializerConfig.DEFAULT, new JavaWriter(writer));
        assertTrue(writer.toString().contains("public class DomainClass implements Serializable {"));
    }
View Full Code Here

Examples of com.mysema.codegen.JavaWriter

    @Test
    public void Interfaces2() throws IOException {
        BeanSerializer serializer = new BeanSerializer();
        serializer.addInterface(Serializable.class);
        serializer.serialize(type, SimpleSerializerConfig.DEFAULT, new JavaWriter(writer));
        assertTrue(writer.toString().contains("public class DomainClass implements Serializable {"));
    }
View Full Code Here

Examples of com.mysema.codegen.JavaWriter

        type.addProperty(new Property(type, "arrayField", new ClassType(TypeCategory.ARRAY, String[].class)));
        type.addProperty(new Property(type, "mapField", new SimpleType(Types.MAP, typeModel, typeModel)));

        BeanSerializer serializer = new BeanSerializer();
        serializer.setAddToString(true);
        serializer.serialize(type, SimpleSerializerConfig.DEFAULT, new JavaWriter(writer));
        //System.out.println(writer.toString());
    }
View Full Code Here

Examples of com.mysema.codegen.JavaWriter

        type.addProperty(new Property(type, "arrayField", new ClassType(TypeCategory.ARRAY, String[].class)));
        type.addProperty(new Property(type, "mapField", new SimpleType(Types.MAP, typeModel, typeModel)));

        BeanSerializer serializer = new BeanSerializer();
        serializer.setAddFullConstructor(true);
        serializer.serialize(type, SimpleSerializerConfig.DEFAULT, new JavaWriter(writer));
        //System.out.println(writer.toString());
    }
View Full Code Here

Examples of com.mysema.codegen.JavaWriter

            Type classType = new ClassType(TypeCategory.get(cl.getName()), cl);
            type.addProperty(new Property(type, StringUtils.uncapitalize(cl.getSimpleName()), classType));
        }

        BeanSerializer serializer = new BeanSerializer();
        serializer.serialize(type, SimpleSerializerConfig.DEFAULT, new JavaWriter(writer));
        String str = writer.toString();
        //System.err.println(str);
        for (String prop : Arrays.asList(
                "String[] arrayField;",
                "Boolean boolean$;",
View Full Code Here

Examples of com.mysema.codegen.JavaWriter

    private void write(Serializer serializer, String path, EntityType type) throws IOException {
        File targetFile = new File(targetFolder, path);
        classes.add(targetFile.getPath());
        StringWriter w = new StringWriter();
        CodeWriter writer = createScalaSources ? new ScalaWriter(w) : new JavaWriter(w);
        serializer.serialize(type, SimpleSerializerConfig.DEFAULT, writer);

        // conditional creation
        boolean generate = true;
        byte[] bytes = w.toString().getBytes(sourceEncoding);
View Full Code Here

Examples of com.mysema.codegen.JavaWriter

        entityType.addProperty(new Property(entityType, "property", new ClassType(Double[].class)));
        typeMappings.register(new ClassType(Double[].class), new ClassType(Point.class));
        typeMappings.register(entityType, queryTypeFactory.create(entityType));
        assertTrue(typeMappings.isRegistered(entityType.getProperties().iterator().next().getType()));

        serializer.serialize(entityType, SimpleSerializerConfig.DEFAULT, new JavaWriter(writer));
        assertTrue(writer.toString().contains(
                "public final com.mysema.query.codegen.Point property = " +
          "new com.mysema.query.codegen.Point(forProperty(\"property\"));"));
    }
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.