Package com.mysema.codegen.model

Examples of com.mysema.codegen.model.Type


    }

    @Test
    public void Generics_Object() throws SecurityException, NoSuchFieldException{
        Field field = getClass().getDeclaredField("field2");
        Type type = factory.get(field.getType(), field.getGenericType());
        assertEquals(1, type.getParameters().size());
        assertEquals(Types.OBJECT, type.getParameters().get(0));
    }
View Full Code Here


        assertEquals(Types.OBJECT, type.getParameters().get(0));
    }

    @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 Generics_Wildcard() throws SecurityException, NoSuchFieldException {
        Field field = DefaultQueryMetadata.class.getDeclaredField("exprInJoins");
        Type type = factory.get(field.getType(), field.getGenericType());
        assertEquals(TypeCategory.SET, type.getCategory());
        Type parameter = type.getParameters().get(0);
        assertEquals(Expression.class, parameter.getJavaClass());
        parameter = parameter.getParameters().get(0);
        assertEquals(TypeExtends.class, parameter.getClass());
        assertNull(((TypeExtends)parameter).getVarName());
    }
View Full Code Here

        assertNull(((TypeExtends)parameter).getVarName());
    }

    @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

    }

    @Test
    public void RawField() throws SecurityException, NoSuchFieldException{
        Field field = getClass().getDeclaredField("field3");
        Type type = factory.get(field.getType(), field.getGenericType());
        assertEquals(1, type.getParameters().size());
//        assertEquals(Types.OBJECT, type.getParameters().get(0));
    }
View Full Code Here

    }

    @Test
    public void Extends() throws SecurityException, NoSuchFieldException{
        Field field = getClass().getDeclaredField("field4");
        Type type = factory.get(field.getType(), field.getGenericType());
        assertEquals(1, type.getParameters().size());
//        assertEquals(Types.OBJECT, type.getParameters().get(0));
    }
View Full Code Here

//        assertEquals(Types.OBJECT, type.getParameters().get(0));
    }

    @Test
    public void ClassName() {
        Type type = factory.get(EnumExample.class);
        assertEquals("com.mysema.query.codegen.TypeFactoryTest.EnumExample", type.getFullName());
    }
View Full Code Here

        assertEquals("com.mysema.query.codegen.TypeFactoryTest.EnumExample", type.getFullName());
    }

    @Test
    public void Blob() {
        Type blob = factory.get(Blob.class);
        assertEquals("Blob", blob.getSimpleName());
        assertEquals("java.sql.Blob", blob.getFullName());
        assertEquals("java.sql", blob.getPackageName());
    }
View Full Code Here

        assertEquals("java.sql", blob.getPackageName());
    }

    @Test
    public void Boolean() {
        Type bo = factory.get(boolean.class);
        assertEquals(TypeCategory.BOOLEAN, bo.getCategory());
        assertEquals("Boolean", bo.getSimpleName());
        assertEquals("java.lang.Boolean", bo.getFullName());
        assertEquals("java.lang", bo.getPackageName());
    }
View Full Code Here

    }
   
    @Test
    public void Resolve() {
        TypeFactory factory = new TypeFactory(Collections.<Class<? extends Annotation>>emptyList());
        Type type = factory.get(AbstractCollectionAttribute.class);
        assertEquals("com.mysema.query.codegen.Generic2Test.AbstractCollectionAttribute", type.getGenericName(false));
        assertEquals("com.mysema.query.codegen.Generic2Test.AbstractCollectionAttribute", type.getGenericName(true));
    }
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.