Package com.alibaba.citrus.generictype

Examples of com.alibaba.citrus.generictype.TypeInfo.resolve()


        // resolvedIterableType应当还能再次resolve:Iterable<T=A> => Iterable<T=Integer>
        expectedType = factory.getParameterizedType(Iterable.class, Integer.class);
        ParameterizedTypeInfo context = factory.getParameterizedType(MyClass.class, Integer.class);

        assertEquals(expectedType, resolvedIterableType.resolve(context));
        assertEquals(expectedType, resolvedIterableType.resolve(context, true));
        assertEquals(expectedType, resolvedIterableType.resolve(context, false));

        // includeBaseType==true, Iterable<T=E> => Iterable<T=Number>
        expectedType = factory.getParameterizedType(Iterable.class, Number.class);
View Full Code Here


        // resolvedIterableType应当还能再次resolve:Iterable<T=A> => Iterable<T=Integer>
        expectedType = factory.getParameterizedType(Iterable.class, Integer.class);
        ParameterizedTypeInfo context = factory.getParameterizedType(MyClass.class, Integer.class);

        assertEquals(expectedType, resolvedIterableType.resolve(context));
        assertEquals(expectedType, resolvedIterableType.resolve(context, true));
        assertEquals(expectedType, resolvedIterableType.resolve(context, false));

        // includeBaseType==true, Iterable<T=E> => Iterable<T=Number>
        expectedType = factory.getParameterizedType(Iterable.class, Number.class);
View Full Code Here

        expectedType = factory.getParameterizedType(Iterable.class, Integer.class);
        ParameterizedTypeInfo context = factory.getParameterizedType(MyClass.class, Integer.class);

        assertEquals(expectedType, resolvedIterableType.resolve(context));
        assertEquals(expectedType, resolvedIterableType.resolve(context, true));
        assertEquals(expectedType, resolvedIterableType.resolve(context, false));

        // includeBaseType==true, Iterable<T=E> => Iterable<T=Number>
        expectedType = factory.getParameterizedType(Iterable.class, Number.class);

        assertEquals(expectedType, iterableType.resolve(listAType));
View Full Code Here

        // includeBaseType==false, T => A
        TypeInfo varA = myClassType.getTypeParameters().get(0);
        TypeInfo varT = iterableType.getTypeParameters().get(0);

        assertEquals(varA, varT.resolve(listAType, false));

        // includeBaseType==true, T => Number
        assertEquals(factory.getType(Number.class), varT.resolve(listAType));
        assertEquals(factory.getType(Number.class), varT.resolve(listAType, true));
    }
View Full Code Here

        TypeInfo varT = iterableType.getTypeParameters().get(0);

        assertEquals(varA, varT.resolve(listAType, false));

        // includeBaseType==true, T => Number
        assertEquals(factory.getType(Number.class), varT.resolve(listAType));
        assertEquals(factory.getType(Number.class), varT.resolve(listAType, true));
    }

    @Test
    public void resolve_includeBaseType_2() throws Exception {
View Full Code Here

        assertEquals(varA, varT.resolve(listAType, false));

        // includeBaseType==true, T => Number
        assertEquals(factory.getType(Number.class), varT.resolve(listAType));
        assertEquals(factory.getType(Number.class), varT.resolve(listAType, true));
    }

    @Test
    public void resolve_includeBaseType_2() throws Exception {
        ClassTypeInfo listAType = (ClassTypeInfo) factory.getType(MyClass2.class.getField("listA").getGenericType());
View Full Code Here

        // resolvedIterableType应当还能再次resolve:Iterable<T=List.E> => Iterable<T=Integer>
        expectedType = factory.getParameterizedType(Iterable.class, Integer.class);
        ParameterizedTypeInfo context = factory.getParameterizedType(List.class, Integer.class);

        assertEquals(expectedType, resolvedIterableType.resolve(context));
        assertEquals(expectedType, resolvedIterableType.resolve(context, true));
        assertEquals(expectedType, resolvedIterableType.resolve(context, false));

        // includeBaseType==true, Iterable<T=E> => Iterable<T=Object>
        expectedType = factory.getParameterizedType(Iterable.class, Object.class);
View Full Code Here

        // resolvedIterableType应当还能再次resolve:Iterable<T=List.E> => Iterable<T=Integer>
        expectedType = factory.getParameterizedType(Iterable.class, Integer.class);
        ParameterizedTypeInfo context = factory.getParameterizedType(List.class, Integer.class);

        assertEquals(expectedType, resolvedIterableType.resolve(context));
        assertEquals(expectedType, resolvedIterableType.resolve(context, true));
        assertEquals(expectedType, resolvedIterableType.resolve(context, false));

        // includeBaseType==true, Iterable<T=E> => Iterable<T=Object>
        expectedType = factory.getParameterizedType(Iterable.class, Object.class);
View Full Code Here

        expectedType = factory.getParameterizedType(Iterable.class, Integer.class);
        ParameterizedTypeInfo context = factory.getParameterizedType(List.class, Integer.class);

        assertEquals(expectedType, resolvedIterableType.resolve(context));
        assertEquals(expectedType, resolvedIterableType.resolve(context, true));
        assertEquals(expectedType, resolvedIterableType.resolve(context, false));

        // includeBaseType==true, Iterable<T=E> => Iterable<T=Object>
        expectedType = factory.getParameterizedType(Iterable.class, Object.class);

        assertEquals(expectedType, iterableType.resolve(listAType));
View Full Code Here

        // includeBaseType==false, T => List.E
        expectedType = factory.getType(List.class.getTypeParameters()[0]);
        TypeInfo varT = iterableType.getTypeParameters().get(0);

        assertEquals(expectedType, varT.resolve(listAType, false));

        // includeBaseType==true, T => Object
        assertEquals(TypeInfo.OBJECT, varT.resolve(listAType));
        assertEquals(TypeInfo.OBJECT, varT.resolve(listAType, true));
    }
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.