Package com.mysema.codegen.model

Examples of com.mysema.codegen.model.TypeExtends


    @Test
    public void Generics_TypeVariable() {
        Type type = factory.getEntityType(Generic2Test.AbstractCollectionAttribute.class);
        assertEquals(TypeExtends.class, type.getParameters().get(0).getClass());
        TypeExtends t = (TypeExtends) type.getParameters().get(0);
        assertEquals("T", t.getVarName());
    }
View Full Code Here


    @Test
    public void ComparableEntity() {
        Type type = factory.getEntityType(ComparableEntity.class);
        //ComparableEntity<T extends Comparable<? super T>> implements Serializable
        assertEquals(1, type.getParameters().size());
        TypeExtends t = (TypeExtends)type.getParameters().get(0);
        assertEquals("T", t.getVarName());
        assertEquals(1, t.getParameters().size());
    }
View Full Code Here

        type.addProperty(new Property(type, "collection", new ClassType(TypeCategory.COLLECTION, Collection.class, typeModel)));
        type.addProperty(new Property(type, "listField", new ClassType(TypeCategory.LIST, List.class, typeModel)));
        type.addProperty(new Property(type, "setField", new ClassType(TypeCategory.SET, Set.class, typeModel)));
        type.addProperty(new Property(type, "arrayField", new ClassType(TypeCategory.ARRAY, String[].class, typeModel)));
        type.addProperty(new Property(type, "mapField", new ClassType(TypeCategory.MAP, List.class, typeModel, typeModel)));
        type.addProperty(new Property(type, "superTypeField", new TypeExtends(new ClassType(TypeCategory.MAP, List.class, typeModel, typeModel))));
        type.addProperty(new Property(type, "extendsTypeField", new TypeSuper(new ClassType(TypeCategory.MAP, List.class, typeModel, typeModel))));

        for (Class<?> cl : Arrays.asList(Boolean.class, Comparable.class, Integer.class, Date.class, java.sql.Date.class, java.sql.Time.class)) {
            Type classType = new ClassType(TypeCategory.get(cl.getName()), cl);
            type.addProperty(new Property(type, StringUtils.uncapitalize(cl.getSimpleName()), classType));
View Full Code Here

        } else {
            if (rawParameters) {
                type = new SimpleType(type);
            }
            if (!type.isFinal() && extend) {
                type = new TypeExtends(type);
            }
            return new SimpleType(exprType, type);

        }
    }
View Full Code Here

        if (genericType instanceof TypeVariable) {
            TypeVariable tv = (TypeVariable) genericType;
            if (tv.getBounds().length == 1 && tv.getBounds()[0].equals(Object.class)) {
                value = new TypeSuper(tv.getName(), value);
            } else {
                value = new TypeExtends(tv.getName(), value);
            }
        }

        if (entity && !(value instanceof EntityType)) {
            value = new EntityType(value);
View Full Code Here

    private Type getGenericParameter(Class<?> cl, java.lang.reflect.Type genericType, int i) {
        java.lang.reflect.Type parameter = ReflectionUtils.getTypeParameter(genericType, i);
        if (parameter instanceof TypeVariable) {
            TypeVariable variable = (TypeVariable) parameter;
            Type rv = get(ReflectionUtils.getTypeParameterAsClass(genericType, i), null, parameter);
            return new TypeExtends(variable.getName(), rv);
        } else if (parameter instanceof WildcardType
                && ((WildcardType) parameter).getUpperBounds()[0].equals(Object.class)
                && ((WildcardType) parameter).getLowerBounds().length == 0) {
            return ANY;
        } else {
            Type rv = get(ReflectionUtils.getTypeParameterAsClass(genericType, i), null, parameter);
            if (parameter instanceof WildcardType) {
                rv = new TypeExtends(rv);
            }
            return rv;
        }
    }
View Full Code Here

TOP

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

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.