Package com.mysema.codegen.model

Examples of com.mysema.codegen.model.Type


    }
   
    @Test
    public void Resolve2() {
        TypeFactory factory = new TypeFactory(Collections.<Class<? extends Annotation>>emptyList());
        Type type = factory.getEntityType(AbstractCollectionAttribute.class);
        assertEquals("com.mysema.query.codegen.Generic2Test.AbstractCollectionAttribute<? extends java.util.Collection<?>>", type.getGenericName(false));
        assertEquals("com.mysema.query.codegen.Generic2Test.AbstractCollectionAttribute<? extends java.util.Collection<?>>", type.getGenericName(true));
    }
View Full Code Here


public class PropertyTest {

    @Test
    public void Equals_And_HashCode() {
        Type typeModel = new SimpleType(TypeCategory.ENTITY, "com.mysema.query.DomainClass", "com.mysema.query", "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);
View Full Code Here

        assertEquals(p1.hashCode(), p2.hashCode());
    }

    @Test
    public void EscapedName() {
        Type typeModel = new SimpleType(TypeCategory.ENTITY, "com.mysema.query.DomainClass", "com.mysema.query", "DomainClass", false,false);
        EntityType type = new EntityType(typeModel);
        Property property = new Property(type, "boolean", type, Collections.<String>emptyList());
        assertEquals("boolean$", property.getEscapedName());
    }
View Full Code Here

        ser.append("return rv;");

        Map<Object,String> constantToLabel = ser.getConstantToLabel();
        Map<String, Object> constants = getConstants(metadata, constantToLabel);

        Type sourceType = new ClassType(TypeCategory.SIMPLE, source.getType());
        ClassType sourceListType = new ClassType(TypeCategory.SIMPLE, Iterable.class, sourceType);

        return factory.createEvaluator(
                ser.toString(),
                sourceListType,
View Full Code Here

   
    private TypeFactory typeFactory = new TypeFactory();
   
    @Test
    public void HidaBez() {
        Type type = typeFactory.getEntityType(HidaBez.class);
        //System.out.println(type.getGenericName(true));
    }
View Full Code Here

        //System.out.println(type.getGenericName(true));
    }
   
    @Test
    public void HidaBezGruppe() {
        Type type = typeFactory.getEntityType(HidaBezGruppe.class);
        //System.out.println(type.getGenericName(true));
    }
View Full Code Here

        handleConstructors(entityType, elements);
        return entityType;
    }

    private Type getType(VariableElement element) {
        Type rv = typeFactory.getType(element.asType(), true);
        if (element.getAnnotation(QueryType.class) != null) {
            QueryType qt = element.getAnnotation(QueryType.class);
            if (qt.value() != PropertyType.NONE) {
                TypeCategory typeCategory = TypeCategory.valueOf(qt.value().name());
                rv = rv.as(typeCategory);
            }
        }
        return rv;
    }
View Full Code Here

    }

    public List<Parameter> transformParams(List<? extends VariableElement> params) {
        List<Parameter> parameters = new ArrayList<Parameter>(params.size());
        for (VariableElement param : params) {
            Type paramType = getType(param);
            parameters.add(new Parameter(param.getSimpleName().toString(), paramType));
        }
        return parameters;
    }
View Full Code Here

   
    @Test
    public void Base_base() throws SecurityException, NoSuchFieldException {       
        TypeFactory typeFactory = new TypeFactory();
        Field field = Base.class.getDeclaredField("base");
        Type type = typeFactory.get(field.getType(), field.getGenericType());
        assertEquals(0, type.getParameters().size());
    }
View Full Code Here

   
    @Test
    public void Base_base2() throws SecurityException, NoSuchFieldException {       
        TypeFactory typeFactory = new TypeFactory();
        Field field = Base.class.getDeclaredField("base2");
        Type type = typeFactory.get(field.getType(), field.getGenericType());
        assertEquals(2, type.getParameters().size());
        assertNull(((TypeExtends)type.getParameters().get(0)).getVarName());
        assertNull(((TypeExtends)type.getParameters().get(1)).getVarName());
    }
View Full Code Here

TOP

Related Classes of com.mysema.codegen.model.Type

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.