Examples of HierarchyDiscovery


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

*/
public class RawTypeDiscoveryTest {

    @Test
    public void test() {
        Map<Class<?>, Type> map = new HierarchyDiscovery(Qux.class).getTypeMap();
        Assert.assertEquals(5, map.size());
        Assert.assertEquals(Qux.class, map.get(Qux.class));
        Assert.assertEquals(Baz.class, map.get(Baz.class));
        /*
         * The superclasses (respectively, superinterfaces) of a raw type are
View Full Code Here

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

        expectedTypes.add(newParameterizedType(Charlie.class, Integer.class));
        expectedTypes.add(newParameterizedType(Bravo.class, Integer.class));
        expectedTypes.add(newParameterizedType(Alpha.class, Integer.class));
        expectedTypes.add(newParameterizedType(Zulu.class, String.class, Integer.class));

        HierarchyDiscovery discovery = HierarchyDiscovery.forNormalizedType(DeltaImpl.class);
        assertTypeSetMatches(expectedTypes, discovery.getTypeClosure());
    }
View Full Code Here

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

    private void assertTypeEquals(TypeLiteral<?> expectedTypeLiteral, Class beanClass, Field field) {
        assertTypeEquals(expectedTypeLiteral.getType(), beanClass, field);
    }

    private void assertTypeEquals(Type expectedType, Class beanClass, Field field) {
        Type type = new HierarchyDiscovery(beanClass).resolveType(field.getGenericType());
        Assert.assertEquals(type, expectedType);
    }
View Full Code Here

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

    private class BeanInjectionPointTypeAttribute extends TypeAttribute {
        private static final long serialVersionUID = 6927120066961769765L;

        @Override
        protected Type resolveType() {
            return new HierarchyDiscovery(getBean().getBeanClass()).resolveType(getAnnotated().getBaseType());
        }
View Full Code Here

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

            this.componentClass = componentClass;
        }

        @Override
        protected Type resolveType() {
            return new HierarchyDiscovery(componentClass).resolveType(getAnnotated().getBaseType());
        }
View Full Code Here

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

    }

    @Test
    public void testStackOverflow() throws Throwable {
        Type type = AdvancedMap.class.getMethod("getReallyAdvancedMap").getGenericReturnType();
        HierarchyDiscovery discovery = new HierarchyDiscovery(type);

        discovery.getTypeClosure();
    }
View Full Code Here

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

    private final transient HierarchyDiscovery injectionPointTypeHierarchy;
    private transient volatile CachedObservers cachedObservers;

    private EventImpl(InjectionPoint injectionPoint, BeanManagerImpl beanManager) {
        super(injectionPoint, null, beanManager);
        this.injectionPointTypeHierarchy = new HierarchyDiscovery(getType());
    }
View Full Code Here

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

             * Examining the hierarchy of the specified type did not help. This may still be one of the cases when combining the
             * event type and the specified type reveals the actual values for type variables. Let's try that.
             */
            Type canonicalEventType = Types.getCanonicalType(event.getClass());
            TypeResolver objectTypeResolver = new EventObjectTypeResolverBuilder(injectionPointTypeHierarchy.getResolver()
                    .getResolvedTypeVariables(), new HierarchyDiscovery(canonicalEventType).getResolver()
                    .getResolvedTypeVariables()).build();
            resolvedType = objectTypeResolver.resolveType(canonicalEventType);
        }
        return resolvedType;
    }
View Full Code Here

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

     */
    public static <T> Set<Type> getTypes(EnhancedAnnotated<T, ?> annotated, EjbDescriptor<T> ejbDescriptor) {
        ImmutableSet.Builder<Type> types = ImmutableSet.builder();
        // session beans
        Map<Class<?>, Type> typeMap = new LinkedHashMap<Class<?>, Type>();
        HierarchyDiscovery beanClassDiscovery = HierarchyDiscovery.forNormalizedType(ejbDescriptor.getBeanClass());
        for (BusinessInterfaceDescriptor<?> businessInterfaceDescriptor : ejbDescriptor.getLocalBusinessInterfaces()) {
            // first we need to resolve the local interface
            Type resolvedLocalInterface = beanClassDiscovery.resolveType(Types.getCanonicalType(businessInterfaceDescriptor.getInterface()));
            SessionBeanHierarchyDiscovery interfaceDiscovery = new SessionBeanHierarchyDiscovery(resolvedLocalInterface);
            if (beanClassDiscovery.getTypeMap().containsKey(businessInterfaceDescriptor.getInterface())) {
                // WELD-1675 Only add types also included in Annotated.getTypeClosure()
                for (Entry<Class<?>, Type> entry : interfaceDiscovery.getTypeMap().entrySet()) {
                    if (annotated.getTypeClosure().contains(entry.getValue())) {
                        typeMap.put(entry.getKey(), entry.getValue());
                    }
View Full Code Here

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

         * Special handling for array event types as eventType closure does not contain the type closure of array component type
         * this is here for backwards compatibility - see ObserverMethodWithParametertizedTypeTest.testObserverMethodCanObserveArrayWildcard()
         */
        if (Types.isArray(observedType) && Types.isArray(eventType)) {
            final Type observedComponentType = Types.getArrayComponentType(observedType);
            for (Type type : new HierarchyDiscovery(Types.getArrayComponentType(eventType)).getTypeClosure()) {
                if (matchesNoBoxing(observedComponentType, type)) {
                    return true;
                }
            }
            return false;
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.