Package org.jboss.weld.util.reflection

Examples of org.jboss.weld.util.reflection.GenericArrayTypeImpl


        assertFalse(CovariantTypes.isAssignableFrom(new GenericArrayTypeImpl(Collection.class, Number.class), WildcardTypeImpl.withLowerBound(new ParameterizedTypeImpl(Collection.class, Integer.class))));
    }

    @Test
    public void testGenericArrayTypeAssignableFromGenericArrayType() {
        assertTrue(CovariantTypes.isAssignableFrom(new GenericArrayTypeImpl(Collection.class, Number.class), new GenericArrayTypeImpl(Collection.class, Number.class)));
        assertTrue(CovariantTypes.isAssignableFrom(new GenericArrayTypeImpl(Collection.class, Number.class), new GenericArrayTypeImpl(List.class, Number.class)));
        assertTrue(CovariantTypes.isAssignableFrom(new GenericArrayTypeImpl(Collection.class, Number.class), new GenericArrayTypeImpl(ArrayList.class, Number.class)));
        assertTrue(CovariantTypes.isAssignableFrom(new GenericArrayTypeImpl(Collection.class, WildcardTypeImpl.defaultInstance()), new GenericArrayTypeImpl(ArrayList.class, Number.class)));
        assertFalse(CovariantTypes.isAssignableFrom(new GenericArrayTypeImpl(Collection.class, Number.class), new GenericArrayTypeImpl(Iterable.class, Number.class)));
        assertFalse(CovariantTypes.isAssignableFrom(new GenericArrayTypeImpl(Collection.class, Number.class), new GenericArrayTypeImpl(Collection.class, Object.class)));
        assertFalse(CovariantTypes.isAssignableFrom(new GenericArrayTypeImpl(Collection.class, Number.class), new GenericArrayTypeImpl(Collection.class, Integer.class)));
        assertFalse(CovariantTypes.isAssignableFrom(new GenericArrayTypeImpl(Collection.class, Number.class), new GenericArrayTypeImpl(Collection.class, Double.class)));
    }
View Full Code Here


        assertTrue(getRules().matches(type1, type2));
    }

    @Test
    public void testArrayCovariance2() {
        Type type1 = new GenericArrayTypeImpl(new TypeLiteral<List<?>>() {
        }.getType());
        Type type2 = new List[0].getClass();
        assertTrue(getRules().matches(type2, type1));
    }
View Full Code Here

            Class<?> componentType = clazz.getComponentType();
            Type resolvedComponentType = getCanonicalType(componentType);
            if (componentType != resolvedComponentType) {
                // identity check intentional
                // a different identity means that we actually replaced the component Class with a ParameterizedType
                return new GenericArrayTypeImpl(resolvedComponentType);
            }
        }
        if (clazz.getTypeParameters().length > 0) {
            Type[] actualTypeParameters = clazz.getTypeParameters();
            return new ParameterizedTypeImpl(clazz, actualTypeParameters, clazz.getDeclaringClass());
View Full Code Here

TOP

Related Classes of org.jboss.weld.util.reflection.GenericArrayTypeImpl

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.