Refine search
private void checkDecoratedMethods(EnhancedAnnotatedType<T> type, List<Decorator<?>> decorators) { if (type.isFinal()) { throw BeanLogger.LOG.finalBeanClassWithDecoratorsNotAllowed(this); } checkNoArgsConstructor(type); for (Decorator<?> decorator : decorators) { EnhancedAnnotatedType<?> decoratorClass; if (decorator instanceof DecoratorImpl<?>) { DecoratorImpl<?> decoratorBean = (DecoratorImpl<?>) decorator; decoratorClass = decoratorBean.getBeanManager().getServices().get(ClassTransformer.class) .getEnhancedAnnotatedType(decoratorBean.getAnnotated()); } else if (decorator instanceof CustomDecoratorWrapper<?>) { decoratorClass = ((CustomDecoratorWrapper<?>) decorator).getEnhancedAnnotated(); } else { throw BeanLogger.LOG.nonContainerDecorator(decorator); } for (EnhancedAnnotatedMethod<?, ?> decoratorMethod : decoratorClass.getEnhancedMethods()) { EnhancedAnnotatedMethod<?, ?> method = type.getEnhancedMethod(decoratorMethod.getSignature()); if (method != null && !method.isStatic() && !method.isPrivate() && method.isFinal()) { throw BeanLogger.LOG.finalBeanClassWithInterceptorsNotAllowed(this); } } } }
protected <T> void processBean(Bean<T> bean) { BeanManagerImpl beanManager = getOrCreateBeanDeployment(bean.getBeanClass()).getBeanManager(); if (bean instanceof Interceptor<?>) { beanManager.addInterceptor((Interceptor<?>) bean); } else if (bean instanceof Decorator<?>) { beanManager.addDecorator(CustomDecoratorWrapper.of((Decorator<?>) bean, beanManager)); } else { beanManager.addBean(bean); } containerLifecycleEvents.fireProcessBean(beanManager, bean); }
/** * Indicates whether a {@link Decorator} is passivation capable or not. * @return */ public static boolean isPassivationCapable(Decorator<?> decorator) { if (decorator instanceof CustomDecoratorWrapper<?>) { // unwrap decorator = Reflections.<CustomDecoratorWrapper<?>>cast(decorator).delegate(); } if (decorator instanceof DecoratorImpl<?>) { DecoratorImpl<?> weldDecorator = (DecoratorImpl<?>) decorator; return weldDecorator.getEnhancedAnnotated().isSerializable(); } return decorator instanceof PassivationCapable; } }
public static <T> CustomDecoratorWrapper<T> of(Decorator<T> delegate, BeanManagerImpl beanManager) { return new CustomDecoratorWrapper<T>(delegate, beanManager); }
beanManager.addInterceptor((Interceptor<?>) bean); if (priority != null) { globalEnablementBuilder.addInterceptor(bean.getBeanClass(), priority); beanManager.addDecorator(CustomDecoratorWrapper.of((Decorator<?>) bean, beanManager)); if (priority != null) { globalEnablementBuilder.addDecorator(bean.getBeanClass(), priority); beanManager.addBean(bean); if (priority != null && bean.isAlternative()) { globalEnablementBuilder.addAlternative(bean.getBeanClass(), priority);
/** * Indicates whether a {@link Decorator} is passivation capable or not. * @return */ public static boolean isPassivationCapable(Decorator<?> decorator) { if (decorator instanceof CustomDecoratorWrapper<?>) { // unwrap decorator = Reflections.<CustomDecoratorWrapper<?>>cast(decorator).delegate(); } if (decorator instanceof DecoratorImpl<?>) { DecoratorImpl<?> weldDecorator = (DecoratorImpl<?>) decorator; return weldDecorator.getEnhancedAnnotated().isSerializable(); } return decorator instanceof PassivationCapable; } }
public static <T> CustomDecoratorWrapper<T> of(Decorator<T> delegate, BeanManagerImpl beanManager) { return new CustomDecoratorWrapper<T>(delegate, beanManager); }
protected void checkDecoratedMethods(EnhancedAnnotatedType<T> type, List<Decorator<?>> decorators) { if (type.isFinal()) { throw BeanLogger.LOG.finalBeanClassWithDecoratorsNotAllowed(this); } checkNoArgsConstructor(type); for (Decorator<?> decorator : decorators) { EnhancedAnnotatedType<?> decoratorClass; if (decorator instanceof DecoratorImpl<?>) { DecoratorImpl<?> decoratorBean = (DecoratorImpl<?>) decorator; decoratorClass = decoratorBean.getBeanManager().getServices().get(ClassTransformer.class).getEnhancedAnnotatedType(decoratorBean.getAnnotated()); } else if (decorator instanceof CustomDecoratorWrapper<?>) { decoratorClass = ((CustomDecoratorWrapper<?>) decorator).getEnhancedAnnotated(); } else { throw BeanLogger.LOG.nonContainerDecorator(decorator); } for (EnhancedAnnotatedMethod<?, ?> decoratorMethod : decoratorClass.getEnhancedMethods()) { EnhancedAnnotatedMethod<?, ?> method = type.getEnhancedMethod(decoratorMethod.getSignature()); if (method != null && !method.isStatic() && !method.isPrivate() && method.isFinal()) { throw BeanLogger.LOG.finalBeanClassWithInterceptorsNotAllowed(this); } } } }
beanManager.addInterceptor((Interceptor<?>) bean); if (priority != null) { globalEnablementBuilder.addInterceptor(bean.getBeanClass(), priority); beanManager.addDecorator(CustomDecoratorWrapper.of((Decorator<?>) bean, beanManager)); if (priority != null) { globalEnablementBuilder.addDecorator(bean.getBeanClass(), priority); beanManager.addBean(bean); if (priority != null && bean.isAlternative()) { globalEnablementBuilder.addAlternative(bean.getBeanClass(), priority);
/** * Indicates whether a {@link Decorator} is passivation capable or not. * @return */ public static boolean isPassivationCapable(Decorator<?> decorator) { if (decorator instanceof CustomDecoratorWrapper<?>) { // unwrap decorator = Reflections.<CustomDecoratorWrapper<?>>cast(decorator).delegate(); } if (decorator instanceof DecoratorImpl<?>) { DecoratorImpl<?> weldDecorator = (DecoratorImpl<?>) decorator; return weldDecorator.getEnhancedAnnotated().isSerializable(); } return decorator instanceof PassivationCapable; } }
public static <T> CustomDecoratorWrapper<T> of(Decorator<T> delegate, BeanManagerImpl beanManager) { return new CustomDecoratorWrapper<T>(delegate, beanManager); }
protected void checkDecoratedMethods(EnhancedAnnotatedType<T> type, List<Decorator<?>> decorators) { if (type.isFinal()) { throw BeanLogger.LOG.finalBeanClassWithDecoratorsNotAllowed(this); } checkNoArgsConstructor(type); for (Decorator<?> decorator : decorators) { EnhancedAnnotatedType<?> decoratorClass; if (decorator instanceof DecoratorImpl<?>) { DecoratorImpl<?> decoratorBean = (DecoratorImpl<?>) decorator; decoratorClass = decoratorBean.getBeanManager().getServices().get(ClassTransformer.class).getEnhancedAnnotatedType(decoratorBean.getAnnotated()); } else if (decorator instanceof CustomDecoratorWrapper<?>) { decoratorClass = ((CustomDecoratorWrapper<?>) decorator).getEnhancedAnnotated(); } else { throw BeanLogger.LOG.nonContainerDecorator(decorator); } for (EnhancedAnnotatedMethod<?, ?> decoratorMethod : decoratorClass.getEnhancedMethods()) { EnhancedAnnotatedMethod<?, ?> method = type.getEnhancedMethod(decoratorMethod.getSignature()); if (method != null && !method.isStatic() && !method.isPrivate() && method.isFinal()) { throw BeanLogger.LOG.finalBeanClassWithInterceptorsNotAllowed(this); } } } }
beanManager.addInterceptor((Interceptor<?>) bean); if (priority != null) { globalEnablementBuilder.addInterceptor(bean.getBeanClass(), priority); beanManager.addDecorator(CustomDecoratorWrapper.of((Decorator<?>) bean, beanManager)); if (priority != null) { globalEnablementBuilder.addDecorator(bean.getBeanClass(), priority); beanManager.addBean(bean); if (priority != null && bean.isAlternative()) { globalEnablementBuilder.addAlternative(bean.getBeanClass(), priority);
/** * Indicates whether a {@link Decorator} is passivation capable or not. * @return */ public static boolean isPassivationCapable(Decorator<?> decorator) { if (decorator instanceof CustomDecoratorWrapper<?>) { // unwrap decorator = Reflections.<CustomDecoratorWrapper<?>>cast(decorator).delegate(); } if (decorator instanceof DecoratorImpl<?>) { DecoratorImpl<?> weldDecorator = (DecoratorImpl<?>) decorator; return weldDecorator.getEnhancedAnnotated().isSerializable(); } return decorator instanceof PassivationCapable; } }
public static <T> CustomDecoratorWrapper<T> of(Decorator<T> delegate, BeanManagerImpl beanManager) { return new CustomDecoratorWrapper<T>(delegate, beanManager); }
protected void checkDecoratedMethods(EnhancedAnnotatedType<T> type, List<Decorator<?>> decorators) { if (type.isFinal()) { throw BeanLogger.LOG.finalBeanClassWithDecoratorsNotAllowed(this); } checkNoArgsConstructor(type); for (Decorator<?> decorator : decorators) { EnhancedAnnotatedType<?> decoratorClass; if (decorator instanceof DecoratorImpl<?>) { DecoratorImpl<?> decoratorBean = (DecoratorImpl<?>) decorator; decoratorClass = decoratorBean.getBeanManager().getServices().get(ClassTransformer.class).getEnhancedAnnotatedType(decoratorBean.getAnnotated()); } else if (decorator instanceof CustomDecoratorWrapper<?>) { decoratorClass = ((CustomDecoratorWrapper<?>) decorator).getEnhancedAnnotated(); } else { throw BeanLogger.LOG.nonContainerDecorator(decorator); } for (EnhancedAnnotatedMethod<?, ?> decoratorMethod : decoratorClass.getEnhancedMethods()) { EnhancedAnnotatedMethod<?, ?> method = type.getEnhancedMethod(decoratorMethod.getSignature()); if (method != null && !method.isStatic() && !method.isPrivate() && method.isFinal()) { throw BeanLogger.LOG.finalBeanClassWithInterceptorsNotAllowed(this); } } } }
beanManager.addInterceptor((Interceptor<?>) bean); if (priority != null) { globalEnablementBuilder.addInterceptor(bean.getBeanClass(), priority); beanManager.addDecorator(CustomDecoratorWrapper.of((Decorator<?>) bean, beanManager)); if (priority != null) { globalEnablementBuilder.addDecorator(bean.getBeanClass(), priority); beanManager.addBean(bean); if (priority != null && bean.isAlternative()) { globalEnablementBuilder.addAlternative(bean.getBeanClass(), priority);
/** * Indicates whether a {@link Decorator} is passivation capable or not. * @return */ public static boolean isPassivationCapable(Decorator<?> decorator) { if (decorator instanceof CustomDecoratorWrapper<?>) { // unwrap decorator = Reflections.<CustomDecoratorWrapper<?>>cast(decorator).delegate(); } if (decorator instanceof DecoratorImpl<?>) { DecoratorImpl<?> weldDecorator = (DecoratorImpl<?>) decorator; return weldDecorator.getEnhancedAnnotated().isSerializable(); } return decorator instanceof PassivationCapable; } }
public static <T> CustomDecoratorWrapper<T> of(Decorator<T> delegate, BeanManagerImpl beanManager) { return new CustomDecoratorWrapper<T>(delegate, beanManager); }
protected void checkDecoratedMethods(EnhancedAnnotatedType<T> type, List<Decorator<?>> decorators) { if (type.isFinal()) { throw BeanLogger.LOG.finalBeanClassWithDecoratorsNotAllowed(this); } checkNoArgsConstructor(type); for (Decorator<?> decorator : decorators) { EnhancedAnnotatedType<?> decoratorClass; if (decorator instanceof DecoratorImpl<?>) { DecoratorImpl<?> decoratorBean = (DecoratorImpl<?>) decorator; decoratorClass = decoratorBean.getBeanManager().getServices().get(ClassTransformer.class).getEnhancedAnnotatedType(decoratorBean.getAnnotated()); } else if (decorator instanceof CustomDecoratorWrapper<?>) { decoratorClass = ((CustomDecoratorWrapper<?>) decorator).getEnhancedAnnotated(); } else { throw BeanLogger.LOG.nonContainerDecorator(decorator); } for (EnhancedAnnotatedMethod<?, ?> decoratorMethod : decoratorClass.getEnhancedMethods()) { EnhancedAnnotatedMethod<?, ?> method = type.getEnhancedMethod(decoratorMethod.getSignature()); if (method != null && !method.isStatic() && !method.isPrivate() && method.isFinal()) { throw BeanLogger.LOG.finalBeanClassWithInterceptorsNotAllowed(this); } } } }