Package com.mysema.codegen

Examples of com.mysema.codegen.JavaWriter


    @Test
    public void Primitive_Array() throws IOException{
        SimpleType type = new SimpleType(TypeCategory.ENTITY, "Entity", "", "Entity",false,false);
        EntityType entityType = new EntityType(type);
        entityType.addProperty(new Property(entityType, "bytes", new ClassType(byte[].class)));
        serializer.serialize(entityType, SimpleSerializerConfig.DEFAULT, new JavaWriter(writer));
        assertTrue(writer.toString().contains("public final SimplePath<byte[]> bytes"));
    }
View Full Code Here


        entityType.addProperty(new Property(entityType, "t", new ClassType(TypeCategory.TIME, Time.class)));

        EntityType subType = new EntityType(new SimpleType(TypeCategory.ENTITY, "Entity2", "", "Entity2",false,false));
        subType.include(new Supertype(type,entityType));

        serializer.serialize(subType, SimpleSerializerConfig.DEFAULT, new JavaWriter(writer));
        // TODO : assertions
    }
View Full Code Here

        SimpleType type = new SimpleType(TypeCategory.ENTITY, "Entity", "", "Entity",false,false);
        EntityType entityType = new EntityType(type, Collections.singleton(new Supertype(superType, superType)));
        typeMappings.register(superType, queryTypeFactory.create(superType));
        typeMappings.register(entityType, queryTypeFactory.create(entityType));

        serializer.serialize(entityType, SimpleSerializerConfig.DEFAULT, new JavaWriter(writer));
        assertTrue(writer.toString().contains("public final QEntity2 _super = new QEntity2(this);"));
    }
View Full Code Here

        SimpleType type = new SimpleType(TypeCategory.ENTITY, "Entity", "", "Entity",false,false);
        EntityType entityType = new EntityType(type);
        Delegate delegate = new Delegate(type, type, "test", Collections.<Parameter>emptyList(), Types.STRING);
        entityType.addDelegate(delegate);

        serializer.serialize(entityType, SimpleSerializerConfig.DEFAULT, new JavaWriter(writer));
        assertTrue(writer.toString().contains("return Entity.test(this);"));
    }
View Full Code Here

            EntityType type) throws IOException {
        File targetFile = new File(targetFolder, path);
        generatedFiles.add(targetFile);
        Writer w = writerFor(targetFile);
        try {
            CodeWriter writer = createScalaSources ? new ScalaWriter(w) : new JavaWriter(w);
            serializer.serialize(type, serializerConfig, writer);
        } finally {
            w.close();
        }
    }
View Full Code Here

    }

    @Test
    public void EntitySerializer() throws Exception {
        new EntitySerializer(typeMappings, Collections.<String>emptyList())
            .serialize(type, SimpleSerializerConfig.DEFAULT, new JavaWriter(writer));
    }
View Full Code Here

    }

    @Test
    public void EntitySerializer2() throws Exception {
        new EntitySerializer(typeMappings,Collections.<String>emptyList())
            .serialize(type, new SimpleSerializerConfig(true,true,true,true,""), new JavaWriter(writer));
    }
View Full Code Here

    }

    @Test
    public void EmbeddableSerializer() throws Exception {
        new EmbeddableSerializer(typeMappings,Collections.<String>emptyList())
            .serialize(type, SimpleSerializerConfig.DEFAULT, new JavaWriter(writer));
    }
View Full Code Here

    }

    @Test
    public void SupertypeSerializer() throws IOException{
        new SupertypeSerializer(typeMappings,Collections.<String>emptyList())
            .serialize(type, SimpleSerializerConfig.DEFAULT, new JavaWriter(writer));
    }
View Full Code Here

    }

    @Test
    public void DTOSerializer() throws IOException{
        new ProjectionSerializer(typeMappings)
            .serialize(type, SimpleSerializerConfig.DEFAULT, new JavaWriter(writer));
    }
View Full Code Here

TOP

Related Classes of com.mysema.codegen.JavaWriter

Copyright © 2018 www.massapicom. 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.