/** * Determines the set of {@link InvokableAnnotatedMethod}s representing decorated methods of the specified decorator. A decorated method * is any method declared by a decorated type which is implemented by the decorator. * * @param beanManager the bean manager * @param decorator the specified decorator * @return the set of {@link InvokableAnnotatedMethod}s representing decorated methods of the specified decorator */ public static Set<InvokableAnnotatedMethod<?>> getDecoratorMethods(BeanManagerImpl beanManager, WeldDecorator<?> decorator) { ImmutableSet.Builder<InvokableAnnotatedMethod<?>> builder = ImmutableSet.builder(); for (Type type : decorator.getDecoratedTypes()) { EnhancedAnnotatedType<?> weldClass = getEnhancedAnnotatedTypeOfDecoratedType(beanManager, type); for (EnhancedAnnotatedMethod<?, ?> method : weldClass.getDeclaredEnhancedMethods()) { if (decorator.getEnhancedAnnotated().getEnhancedMethod(method.getSignature()) != null) { builder.add(InvokableAnnotatedMethod.of(method.slim())); } } } return builder.build(); }
private Object doInvoke(WeldDecorator<?> weldDecorator, Object decoratorInstance, Method method, Object[] args) throws Throwable { if (!method.isAnnotationPresent(Inject.class)) { InvokableAnnotatedMethod<?> decoratorMethod = weldDecorator.getDecoratorMethod(method); if (decoratorMethod != null) { try { return decoratorMethod.invokeOnInstance(decoratorInstance, args); } catch (InvocationTargetException e) { throw e.getCause(); } } } SecurityActions.ensureAccessible(method); return Reflections.invokeAndUnwrap(getTargetInstance(), method, args); } }
Decorators.checkDelegateType(decorator); if (delegateType instanceof ParameterizedType) { ParameterizedType parameterizedDelegateType = (ParameterizedType) delegateType; if (!Decorators.isPassivationCapable(decorator)) { if (Instance.class.equals(parameterizedDelegateType.getRawType()) || Provider.class.equals(parameterizedDelegateType.getRawType())) { throw ValidatorLogger.LOG.builtinBeanWithNonserializableDecorator(decorator, Instance.class.getName()); EnhancedAnnotatedType<?> annotated = ((WeldDecorator<?>) decorator).getEnhancedAnnotated(); throw ValidatorLogger.LOG.decoratorsCannotHaveObserverMethods(decorator); while (annotated != null && annotated.getJavaClass() != Object.class) { if (!annotated.getDeclaredEnhancedMethods(Produces.class).isEmpty()) { throw ValidatorLogger.LOG.decoratorsCannotHaveProducerMethods(decorator); if (!annotated.getDeclaredEnhancedFields(Produces.class).isEmpty()) { throw ValidatorLogger.LOG.decoratorsCannotHaveProducerFields(decorator); Decorators.findDelegateInjectionPoint(annotated, decorator.getInjectionPoints());
Decorators.checkDelegateType(decorator); if (delegateType instanceof ParameterizedType) { ParameterizedType parameterizedDelegateType = (ParameterizedType) delegateType; if (!Decorators.isPassivationCapable(decorator)) { if (Instance.class.equals(parameterizedDelegateType.getRawType()) || Provider.class.equals(parameterizedDelegateType.getRawType())) { throw ValidatorLogger.LOG.builtinBeanWithNonserializableDecorator(decorator, Instance.class.getName()); EnhancedAnnotatedType<?> annotated = ((WeldDecorator<?>) decorator).getEnhancedAnnotated(); throw ValidatorLogger.LOG.decoratorsCannotHaveObserverMethods(decorator); while (annotated != null && annotated.getJavaClass() != Object.class) { if (!annotated.getDeclaredEnhancedMethods(Produces.class).isEmpty()) { throw ValidatorLogger.LOG.decoratorsCannotHaveProducerMethods(decorator); if (!annotated.getDeclaredEnhancedFields(Produces.class).isEmpty()) { throw ValidatorLogger.LOG.decoratorsCannotHaveProducerFields(decorator); Decorators.findDelegateInjectionPoint(annotated, decorator.getInjectionPoints());
Decorators.checkDelegateType(decorator); if (delegateType instanceof ParameterizedType) { ParameterizedType parameterizedDelegateType = (ParameterizedType) delegateType; if (!Decorators.isPassivationCapable(decorator)) { if (Instance.class.equals(parameterizedDelegateType.getRawType()) || Provider.class.equals(parameterizedDelegateType.getRawType())) { throw ValidatorLogger.LOG.builtinBeanWithNonserializableDecorator(decorator, Instance.class.getName()); EnhancedAnnotatedType<?> annotated = ((WeldDecorator<?>) decorator).getEnhancedAnnotated(); throw ValidatorLogger.LOG.decoratorsCannotHaveObserverMethods(decorator); while (annotated != null && annotated.getJavaClass() != Object.class) { if (!annotated.getDeclaredEnhancedMethods(Produces.class).isEmpty()) { throw ValidatorLogger.LOG.decoratorsCannotHaveProducerMethods(decorator); if (!annotated.getDeclaredEnhancedFields(Produces.class).isEmpty()) { throw ValidatorLogger.LOG.decoratorsCannotHaveProducerFields(decorator); Decorators.findDelegateInjectionPoint(annotated, decorator.getInjectionPoints());
/** * Determines the set of {@link InvokableAnnotatedMethod}s representing decorated methods of the specified decorator. A decorated method * is any method declared by a decorated type which is implemented by the decorator. * * @param beanManager the bean manager * @param decorator the specified decorator * @return the set of {@link InvokableAnnotatedMethod}s representing decorated methods of the specified decorator */ public static Set<InvokableAnnotatedMethod<?>> getDecoratorMethods(BeanManagerImpl beanManager, WeldDecorator<?> decorator) { ImmutableSet.Builder<InvokableAnnotatedMethod<?>> builder = ImmutableSet.builder(); for (Type type : decorator.getDecoratedTypes()) { EnhancedAnnotatedType<?> weldClass = getEnhancedAnnotatedTypeOfDecoratedType(beanManager, type); for (EnhancedAnnotatedMethod<?, ?> method : weldClass.getDeclaredEnhancedMethods()) { if (decorator.getEnhancedAnnotated().getEnhancedMethod(method.getSignature()) != null) { builder.add(InvokableAnnotatedMethod.of(method.slim())); } } } return builder.build(); }
private Object doInvoke(WeldDecorator<?> weldDecorator, Object decoratorInstance, Method method, Object[] args) throws Throwable { if (!method.isAnnotationPresent(Inject.class)) { InvokableAnnotatedMethod<?> decoratorMethod = weldDecorator.getDecoratorMethod(method); if (decoratorMethod != null) { try { return decoratorMethod.invokeOnInstance(decoratorInstance, args); } catch (InvocationTargetException e) { throw e.getCause(); } } } SecurityActions.ensureAccessible(method); return Reflections.invokeAndUnwrap(getTargetInstance(), method, args); } }
Decorators.checkDelegateType(decorator); if (delegateType instanceof ParameterizedType) { ParameterizedType parameterizedDelegateType = (ParameterizedType) delegateType; if (!Decorators.isPassivationCapable(decorator)) { if (Instance.class.equals(parameterizedDelegateType.getRawType()) || Provider.class.equals(parameterizedDelegateType.getRawType())) { throw ValidatorLogger.LOG.builtinBeanWithNonserializableDecorator(decorator, Instance.class.getName()); EnhancedAnnotatedType<?> annotated = ((WeldDecorator<?>) decorator).getEnhancedAnnotated(); throw ValidatorLogger.LOG.decoratorsCannotHaveObserverMethods(decorator); while (annotated != null && annotated.getJavaClass() != Object.class) { if (!annotated.getDeclaredEnhancedMethods(Produces.class).isEmpty()) { throw ValidatorLogger.LOG.decoratorsCannotHaveProducerMethods(decorator); if (!annotated.getDeclaredEnhancedFields(Produces.class).isEmpty()) { throw ValidatorLogger.LOG.decoratorsCannotHaveProducerFields(decorator); Decorators.findDelegateInjectionPoint(annotated, decorator.getInjectionPoints());
/** * Determines the set of {@link InvokableAnnotatedMethod}s representing decorated methods of the specified decorator. A decorated method * is any method declared by a decorated type which is implemented by the decorator. * * @param beanManager the bean manager * @param decorator the specified decorator * @return the set of {@link InvokableAnnotatedMethod}s representing decorated methods of the specified decorator */ public static Set<InvokableAnnotatedMethod<?>> getDecoratorMethods(BeanManagerImpl beanManager, WeldDecorator<?> decorator) { ImmutableSet.Builder<InvokableAnnotatedMethod<?>> builder = ImmutableSet.builder(); for (Type type : decorator.getDecoratedTypes()) { EnhancedAnnotatedType<?> weldClass = getEnhancedAnnotatedTypeOfDecoratedType(beanManager, type); for (EnhancedAnnotatedMethod<?, ?> method : weldClass.getDeclaredEnhancedMethods()) { if (decorator.getEnhancedAnnotated().getEnhancedMethod(method.getSignature()) != null) { builder.add(InvokableAnnotatedMethod.of(method.slim())); } } } return builder.build(); }
private Object doInvoke(WeldDecorator<?> weldDecorator, Object decoratorInstance, Method method, Object[] args) throws Throwable { if (!method.isAnnotationPresent(Inject.class)) { InvokableAnnotatedMethod<?> decoratorMethod = weldDecorator.getDecoratorMethod(method); if (decoratorMethod != null) { try { return decoratorMethod.invokeOnInstance(decoratorInstance, args); } catch (InvocationTargetException e) { throw e.getCause(); } } } SecurityActions.ensureAccessible(method); return Reflections.invokeAndUnwrap(getTargetInstance(), method, args); } }
Decorators.checkDelegateType(decorator); if (delegateType instanceof ParameterizedType) { ParameterizedType parameterizedDelegateType = (ParameterizedType) delegateType; if (!Decorators.isPassivationCapable(decorator)) { if (Instance.class.equals(parameterizedDelegateType.getRawType()) || Provider.class.equals(parameterizedDelegateType.getRawType())) { throw ValidatorLogger.LOG.builtinBeanWithNonserializableDecorator(decorator, Instance.class.getName()); EnhancedAnnotatedType<?> annotated = ((WeldDecorator<?>) decorator).getEnhancedAnnotated(); throw ValidatorLogger.LOG.decoratorsCannotHaveObserverMethods(decorator); while (annotated != null && annotated.getJavaClass() != Object.class) { if (!annotated.getDeclaredEnhancedMethods(Produces.class).isEmpty()) { throw ValidatorLogger.LOG.decoratorsCannotHaveProducerMethods(decorator); if (!annotated.getDeclaredEnhancedFields(Produces.class).isEmpty()) { throw ValidatorLogger.LOG.decoratorsCannotHaveProducerFields(decorator); Decorators.findDelegateInjectionPoint(annotated, decorator.getInjectionPoints());
/** * Determines the set of {@link InvokableAnnotatedMethod}s representing decorated methods of the specified decorator. A decorated method * is any method declared by a decorated type which is implemented by the decorator. * * @param beanManager the bean manager * @param decorator the specified decorator * @return the set of {@link InvokableAnnotatedMethod}s representing decorated methods of the specified decorator */ public static Set<InvokableAnnotatedMethod<?>> getDecoratorMethods(BeanManagerImpl beanManager, WeldDecorator<?> decorator) { ImmutableSet.Builder<InvokableAnnotatedMethod<?>> builder = ImmutableSet.builder(); for (Type type : decorator.getDecoratedTypes()) { EnhancedAnnotatedType<?> weldClass = getEnhancedAnnotatedTypeOfDecoratedType(beanManager, type); for (EnhancedAnnotatedMethod<?, ?> method : weldClass.getDeclaredEnhancedMethods()) { if (decorator.getEnhancedAnnotated().getEnhancedMethod(method.getSignature()) != null) { builder.add(InvokableAnnotatedMethod.of(method.slim())); } } } return builder.build(); }
private Object doInvoke(WeldDecorator<?> weldDecorator, Object decoratorInstance, Method method, Object[] args) throws Throwable { if (!method.isAnnotationPresent(Inject.class)) { InvokableAnnotatedMethod<?> decoratorMethod = weldDecorator.getDecoratorMethod(method); if (decoratorMethod != null) { try { return decoratorMethod.invokeOnInstance(decoratorInstance, args); } catch (InvocationTargetException e) { throw e.getCause(); } } } SecurityActions.ensureAccessible(method); return Reflections.invokeAndUnwrap(getTargetInstance(), method, args); } }
Decorators.checkDelegateType(decorator); if (delegateType instanceof ParameterizedType) { ParameterizedType parameterizedDelegateType = (ParameterizedType) delegateType; if (!Decorators.isPassivationCapable(decorator)) { if (Instance.class.equals(parameterizedDelegateType.getRawType()) || Provider.class.equals(parameterizedDelegateType.getRawType())) { throw ValidatorLogger.LOG.builtinBeanWithNonserializableDecorator(decorator, Instance.class.getName()); EnhancedAnnotatedType<?> annotated = ((WeldDecorator<?>) decorator).getEnhancedAnnotated(); throw ValidatorLogger.LOG.decoratorsCannotHaveObserverMethods(decorator); while (annotated != null && annotated.getJavaClass() != Object.class) { if (!annotated.getDeclaredEnhancedMethods(Produces.class).isEmpty()) { throw ValidatorLogger.LOG.decoratorsCannotHaveProducerMethods(decorator); if (!annotated.getDeclaredEnhancedFields(Produces.class).isEmpty()) { throw ValidatorLogger.LOG.decoratorsCannotHaveProducerFields(decorator); Decorators.findDelegateInjectionPoint(annotated, decorator.getInjectionPoints());
/** * Determines the set of {@link InvokableAnnotatedMethod}s representing decorated methods of the specified decorator. A decorated method * is any method declared by a decorated type which is implemented by the decorator. * * @param beanManager the bean manager * @param decorator the specified decorator * @return the set of {@link InvokableAnnotatedMethod}s representing decorated methods of the specified decorator */ public static Set<InvokableAnnotatedMethod<?>> getDecoratorMethods(BeanManagerImpl beanManager, WeldDecorator<?> decorator) { ImmutableSet.Builder<InvokableAnnotatedMethod<?>> builder = ImmutableSet.builder(); for (Type type : decorator.getDecoratedTypes()) { EnhancedAnnotatedType<?> weldClass = getEnhancedAnnotatedTypeOfDecoratedType(beanManager, type); for (EnhancedAnnotatedMethod<?, ?> method : weldClass.getDeclaredEnhancedMethods()) { if (decorator.getEnhancedAnnotated().getEnhancedMethod(method.getSignature()) != null) { builder.add(InvokableAnnotatedMethod.of(method.slim())); } } } return builder.build(); }
private Object doInvoke(WeldDecorator<?> weldDecorator, Object decoratorInstance, Method method, Object[] args) throws Throwable { if (!method.isAnnotationPresent(Inject.class)) { InvokableAnnotatedMethod<?> decoratorMethod = weldDecorator.getDecoratorMethod(method); if (decoratorMethod != null) { try { return decoratorMethod.invokeOnInstance(decoratorInstance, args); } catch (InvocationTargetException e) { throw e.getCause(); } } } SecurityActions.ensureAccessible(method); return Reflections.invokeAndUnwrap(getTargetInstance(), method, args); } }
/** * Determines the set of {@link InvokableAnnotatedMethod}s representing decorated methods of the specified decorator. A decorated method * is any method declared by a decorated type which is implemented by the decorator. * * @param beanManager the bean manager * @param decorator the specified decorator * @return the set of {@link InvokableAnnotatedMethod}s representing decorated methods of the specified decorator */ public static Set<InvokableAnnotatedMethod<?>> getDecoratorMethods(BeanManagerImpl beanManager, WeldDecorator<?> decorator) { ImmutableSet.Builder<InvokableAnnotatedMethod<?>> builder = ImmutableSet.builder(); for (Type type : decorator.getDecoratedTypes()) { EnhancedAnnotatedType<?> weldClass = getEnhancedAnnotatedTypeOfDecoratedType(beanManager, type); for (EnhancedAnnotatedMethod<?, ?> method : weldClass.getDeclaredEnhancedMethods()) { if (decorator.getEnhancedAnnotated().getEnhancedMethod(method.getSignature()) != null) { builder.add(InvokableAnnotatedMethod.of(method.slim())); } } } return builder.build(); }
private Object doInvoke(WeldDecorator<?> weldDecorator, Object decoratorInstance, Method method, Object[] args) throws Throwable { if (!method.isAnnotationPresent(Inject.class)) { InvokableAnnotatedMethod<?> decoratorMethod = weldDecorator.getDecoratorMethod(method); if (decoratorMethod != null) { try { return decoratorMethod.invokeOnInstance(decoratorInstance, args); } catch (InvocationTargetException e) { throw e.getCause(); } } } SecurityActions.ensureAccessible(method); return Reflections.invokeAndUnwrap(getTargetInstance(), method, args); } }