Package org.jboss.weld.util.reflection

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


    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

             * 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

     */
    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

         * 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

     * @param decorator
     * @throws DefinitionException If the delegate type doesn't implement or extend all decorated types
     */
    public static void checkDelegateType(Decorator<?> decorator) {

        Set<Type> types = new HierarchyDiscovery(decorator.getDelegateType()).getTypeClosure();

        for (Type decoratedType : decorator.getDecoratedTypes()) {
            if(!types.contains(decoratedType)) {
                throw BeanLogger.LOG.delegateMustSupportEveryDecoratedType(decoratedType, decorator);
            }
View Full Code Here

    protected ObserverMethodImpl(final EnhancedAnnotatedMethod<T, ? super X> observer, final RIBean<X> declaringBean, final BeanManagerImpl manager) {
        this.beanManager = manager;
        this.declaringBean = declaringBean;
        this.observerMethod = initMethodInjectionPoint(observer, declaringBean, manager);
        EnhancedAnnotatedParameter<?, ? super X> eventParameter = observer.getEnhancedParameters(Observes.class).get(0);
        this.eventType = new HierarchyDiscovery(declaringBean.getBeanClass()).resolveType(eventParameter.getBaseType());
        this.id = createId(observer, declaringBean);
        this.bindings = manager.getServices().get(SharedObjectCache.class)
                .getSharedSet(observer.getEnhancedParameters(Observes.class).get(0).getMetaAnnotations(Qualifier.class));
        Observes observesAnnotation = observer.getEnhancedParameters(Observes.class).get(0).getAnnotation(Observes.class);
        this.reception = observesAnnotation.notifyObserver();
View Full Code Here

        this.type = type;
    }

    @Override
    protected Set<Type> computeValue() {
        return new HierarchyDiscovery(type).getTypeClosure();
    }
View Full Code Here

        // this is a raw type with missing type arguments
        if (!Types.getCanonicalType(type2).equals(type2)) {
            return true;
        }

        return matches(type1, new HierarchyDiscovery(type2));
    }
View Full Code Here

            return false;
        }
        if (matches(type1, type2)) {
            return true;
        }
        return matches(type1, new HierarchyDiscovery(type2));
    }
View Full Code Here

TOP

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

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.