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); } } } }
public <T, X> MethodInjectionPoint<T, X> createMethodInjectionPoint(MethodInjectionPointType methodInjectionPointType, EnhancedAnnotatedMethod<T, X> enhancedMethod, Bean<?> declaringBean, Class<?> declaringComponentClass, Set<Class<? extends Annotation>> specialParameterMarkers, BeanManagerImpl manager) { if (enhancedMethod.isStatic()) { return new StaticMethodInjectionPoint<T, X>(methodInjectionPointType, enhancedMethod, declaringBean, declaringComponentClass, specialParameterMarkers, this, manager); } else { return new VirtualMethodInjectionPoint<T, X>(methodInjectionPointType, enhancedMethod, declaringBean, declaringComponentClass, specialParameterMarkers, this, manager); } }
public <T, X> MethodInjectionPoint<T, X> createMethodInjectionPoint(MethodInjectionPointType methodInjectionPointType, EnhancedAnnotatedMethod<T, X> enhancedMethod, Bean<?> declaringBean, Class<?> declaringComponentClass, Set<Class<? extends Annotation>> specialParameterMarkers, BeanManagerImpl manager) { if (enhancedMethod.isStatic()) { return new StaticMethodInjectionPoint<T, X>(methodInjectionPointType, enhancedMethod, declaringBean, declaringComponentClass, specialParameterMarkers, this, manager); } else { return new VirtualMethodInjectionPoint<T, X>(methodInjectionPointType, enhancedMethod, declaringBean, declaringComponentClass, specialParameterMarkers, this, manager); } }
public <T, X> MethodInjectionPoint<T, X> createMethodInjectionPoint(MethodInjectionPointType methodInjectionPointType, EnhancedAnnotatedMethod<T, X> enhancedMethod, Bean<?> declaringBean, Class<?> declaringComponentClass, Class<? extends Annotation> specialParameterMarker, BeanManagerImpl manager) { if (enhancedMethod.isStatic()) { return new StaticMethodInjectionPoint<T, X>(methodInjectionPointType, enhancedMethod, declaringBean, declaringComponentClass, specialParameterMarker, this, manager); } else { return new VirtualMethodInjectionPoint<T, X>(methodInjectionPointType, enhancedMethod, declaringBean, declaringComponentClass, specialParameterMarker, this, manager); } }
public <T, X> MethodInjectionPoint<T, X> createMethodInjectionPoint(MethodInjectionPointType methodInjectionPointType, EnhancedAnnotatedMethod<T, X> enhancedMethod, Bean<?> declaringBean, Class<?> declaringComponentClass, Set<Class<? extends Annotation>> specialParameterMarkers, BeanManagerImpl manager) { if (enhancedMethod.isStatic()) { return new StaticMethodInjectionPoint<T, X>(methodInjectionPointType, enhancedMethod, declaringBean, declaringComponentClass, specialParameterMarkers, this, manager); } else { return new VirtualMethodInjectionPoint<T, X>(methodInjectionPointType, enhancedMethod, declaringBean, declaringComponentClass, specialParameterMarkers, this, manager); } }
public <T, X> MethodInjectionPoint<T, X> createMethodInjectionPoint(MethodInjectionPointType methodInjectionPointType, EnhancedAnnotatedMethod<T, X> enhancedMethod, Bean<?> declaringBean, Class<?> declaringComponentClass, Set<Class<? extends Annotation>> specialParameterMarkers, BeanManagerImpl manager) { if (enhancedMethod.isStatic()) { return new StaticMethodInjectionPoint<T, X>(methodInjectionPointType, enhancedMethod, declaringBean, declaringComponentClass, specialParameterMarkers, this, manager); } else { return new VirtualMethodInjectionPoint<T, X>(methodInjectionPointType, enhancedMethod, declaringBean, declaringComponentClass, specialParameterMarkers, this, manager); } }
public static List<EnhancedAnnotatedMethod<?, ?>> getInterceptableMethods(EnhancedAnnotatedType<?> type) { List<EnhancedAnnotatedMethod<?, ?>> annotatedMethods = new ArrayList<EnhancedAnnotatedMethod<?, ?>>(); for (EnhancedAnnotatedMethod<?, ?> annotatedMethod : type.getEnhancedMethods()) { boolean businessMethod = !annotatedMethod.isStatic() && !annotatedMethod.isAnnotationPresent(Inject.class) && !annotatedMethod.getJavaMember().isBridge(); if (businessMethod && !isInterceptorMethod(annotatedMethod)) { annotatedMethods.add(annotatedMethod); } } return annotatedMethods; }
public <T, X> MethodInjectionPoint<T, X> createMethodInjectionPoint(MethodInjectionPointType methodInjectionPointType, EnhancedAnnotatedMethod<T, X> enhancedMethod, Bean<?> declaringBean, Class<?> declaringComponentClass, Set<Class<? extends Annotation>> specialParameterMarkers, BeanManagerImpl manager) { if (enhancedMethod.isStatic()) { return new StaticMethodInjectionPoint<T, X>(methodInjectionPointType, enhancedMethod, declaringBean, declaringComponentClass, specialParameterMarkers, this, manager); } else { return new VirtualMethodInjectionPoint<T, X>(methodInjectionPointType, enhancedMethod, declaringBean, declaringComponentClass, specialParameterMarkers, this, manager); } }
public static List<EnhancedAnnotatedMethod<?, ?>> getInterceptableMethods(EnhancedAnnotatedType<?> type) { List<EnhancedAnnotatedMethod<?, ?>> annotatedMethods = new ArrayList<EnhancedAnnotatedMethod<?, ?>>(); for (EnhancedAnnotatedMethod<?, ?> annotatedMethod : type.getEnhancedMethods()) { boolean businessMethod = !annotatedMethod.isStatic() && !annotatedMethod.isAnnotationPresent(Inject.class) && !annotatedMethod.getJavaMember().isBridge(); if (businessMethod && !isInterceptorMethod(annotatedMethod)) { annotatedMethods.add(annotatedMethod); } } return annotatedMethods; }
public static List<EnhancedAnnotatedMethod<?, ?>> getInterceptableMethods(EnhancedAnnotatedType<?> type) { List<EnhancedAnnotatedMethod<?, ?>> annotatedMethods = new ArrayList<EnhancedAnnotatedMethod<?, ?>>(); for (EnhancedAnnotatedMethod<?, ?> annotatedMethod : type.getEnhancedMethods()) { boolean businessMethod = !annotatedMethod.isStatic() && !annotatedMethod.isAnnotationPresent(Inject.class) && !annotatedMethod.getJavaMember().isBridge(); if (businessMethod && !isInterceptorMethod(annotatedMethod)) { annotatedMethods.add(annotatedMethod); } } return annotatedMethods; }
public static List<EnhancedAnnotatedMethod<?, ?>> getInterceptableMethods(EnhancedAnnotatedType<?> type) { List<EnhancedAnnotatedMethod<?, ?>> annotatedMethods = new ArrayList<EnhancedAnnotatedMethod<?, ?>>(); for (EnhancedAnnotatedMethod<?, ?> annotatedMethod : type.getEnhancedMethods()) { boolean businessMethod = !annotatedMethod.isStatic() && !annotatedMethod.isAnnotationPresent(Inject.class) && !annotatedMethod.getJavaMember().isBridge(); if (businessMethod && !isInterceptorMethod(annotatedMethod)) { annotatedMethods.add(annotatedMethod); } } return annotatedMethods; }
public static List<EnhancedAnnotatedMethod<?, ?>> getInterceptableMethods(EnhancedAnnotatedType<?> type) { List<EnhancedAnnotatedMethod<?, ?>> annotatedMethods = new ArrayList<EnhancedAnnotatedMethod<?, ?>>(); for (EnhancedAnnotatedMethod<?, ?> annotatedMethod : type.getEnhancedMethods()) { boolean businessMethod = !annotatedMethod.isStatic() && !annotatedMethod.isAnnotationPresent(Inject.class) && !annotatedMethod.getJavaMember().isBridge(); if (businessMethod && !isInterceptorMethod(annotatedMethod)) { annotatedMethods.add(annotatedMethod); } } return annotatedMethods; }
private void checkObserverMethods(Collection<EnhancedAnnotatedMethod<?, ? super T>> observerMethods) { if (!observerMethods.isEmpty()) { Set<MethodSignature> businessMethodSignatures = getLocalBusinessMethodSignatures(); Set<MethodSignature> remoteBusinessMethodSignatures = getRemoteBusinessMethodSignatures(); for (EnhancedAnnotatedMethod<?, ? super T> observerMethod : observerMethods) { boolean isLocalBusinessMethod = !remoteBusinessMethodSignatures.contains(observerMethod.getSignature()) && businessMethodSignatures .contains(observerMethod.getSignature()); if (!isLocalBusinessMethod && !observerMethod.isStatic()) { throw BeanLogger.LOG .observerMethodMustBeStaticOrBusiness(observerMethod, Formats.formatAsStackTraceElement(observerMethod.getJavaMember())); } } } }
protected <T, X> void createObserverMethod(RIBean<X> declaringBean, BeanManagerImpl beanManager, EnhancedAnnotatedMethod<T, ? super X> method, Set<ObserverInitializationContext<?, ?>> observerMethodInitializers) { ObserverMethodImpl<T, X> observer = ObserverFactory.create(method, declaringBean, beanManager); ObserverInitializationContext<T, X> observerMethodInitializer = ObserverInitializationContext.of(observer, method); if (Observers.isContainerLifecycleObserverMethod(observer) && method.isStatic()) { throw EventLogger.LOG.staticContainerLifecycleEventObserver(observer, Formats.formatAsStackTraceElement(method.getJavaMember())); } observerMethodInitializers.add(observerMethodInitializer); }
protected <T, X> void createObserverMethod(RIBean<X> declaringBean, BeanManagerImpl beanManager, EnhancedAnnotatedMethod<T, ? super X> method, Set<ObserverInitializationContext<?, ?>> observerMethodInitializers, boolean isAsync) { ObserverMethodImpl<T, X> observer = ObserverFactory.create(method, declaringBean, beanManager, isAsync); ObserverInitializationContext<T, X> observerMethodInitializer = ObserverInitializationContext.of(observer, method); if (Observers.isContainerLifecycleObserverMethod(observer)) { if (isAsync) { throw EventLogger.LOG.asyncContainerLifecycleEventObserver(observer, Formats.formatAsStackTraceElement(method.getJavaMember())); } if (method.isStatic()) { throw EventLogger.LOG.staticContainerLifecycleEventObserver(observer, Formats.formatAsStackTraceElement(method.getJavaMember())); } } observerMethodInitializers.add(observerMethodInitializer); }
protected <T, X> void createObserverMethod(RIBean<X> declaringBean, BeanManagerImpl beanManager, EnhancedAnnotatedMethod<T, ? super X> method, Set<ObserverInitializationContext<?, ?>> observerMethodInitializers, boolean isAsync) { ObserverMethodImpl<T, X> observer = ObserverFactory.create(method, declaringBean, beanManager, isAsync); ObserverInitializationContext<T, X> observerMethodInitializer = ObserverInitializationContext.of(observer, method); if (Observers.isContainerLifecycleObserverMethod(observer)) { if (isAsync) { throw EventLogger.LOG.asyncContainerLifecycleEventObserver(observer, Formats.formatAsStackTraceElement(method.getJavaMember())); } if (method.isStatic()) { throw EventLogger.LOG.staticContainerLifecycleEventObserver(observer, Formats.formatAsStackTraceElement(method.getJavaMember())); } } observerMethodInitializers.add(observerMethodInitializer); }
protected <T, X> void createObserverMethod(RIBean<X> declaringBean, BeanManagerImpl beanManager, EnhancedAnnotatedMethod<T, ? super X> method, Set<ObserverInitializationContext<?, ?>> observerMethodInitializers, boolean isAsync) { ObserverMethodImpl<T, X> observer = ObserverFactory.create(method, declaringBean, beanManager, isAsync); ObserverInitializationContext<T, X> observerMethodInitializer = ObserverInitializationContext.of(observer, method); if (Observers.isContainerLifecycleObserverMethod(observer)) { if (isAsync) { throw EventLogger.LOG.asyncContainerLifecycleEventObserver(observer, Formats.formatAsStackTraceElement(method.getJavaMember())); } if (method.isStatic()) { throw EventLogger.LOG.staticContainerLifecycleEventObserver(observer, Formats.formatAsStackTraceElement(method.getJavaMember())); } } observerMethodInitializers.add(observerMethodInitializer); }
protected <T, X> void createObserverMethod(RIBean<X> declaringBean, BeanManagerImpl beanManager, EnhancedAnnotatedMethod<T, ? super X> method, Set<ObserverInitializationContext<?, ?>> observerMethodInitializers, boolean isAsync) { ObserverMethodImpl<T, X> observer = ObserverFactory.create(method, declaringBean, beanManager, isAsync); ObserverInitializationContext<T, X> observerMethodInitializer = ObserverInitializationContext.of(observer, method); if (Observers.isContainerLifecycleObserverMethod(observer)) { if (isAsync) { throw EventLogger.LOG.asyncContainerLifecycleEventObserver(observer, Formats.formatAsStackTraceElement(method.getJavaMember())); } if (method.isStatic()) { throw EventLogger.LOG.staticContainerLifecycleEventObserver(observer, Formats.formatAsStackTraceElement(method.getJavaMember())); } } observerMethodInitializers.add(observerMethodInitializer); }
protected <T, X> void createObserverMethod(RIBean<X> declaringBean, BeanManagerImpl beanManager, EnhancedAnnotatedMethod<T, ? super X> method, Set<ObserverInitializationContext<?, ?>> observerMethodInitializers, boolean isAsync) { ObserverMethodImpl<T, X> observer = ObserverFactory.create(method, declaringBean, beanManager, isAsync); ObserverInitializationContext<T, X> observerMethodInitializer = ObserverInitializationContext.of(observer, method); if (Observers.isContainerLifecycleObserverMethod(observer)) { if (isAsync) { throw EventLogger.LOG.asyncContainerLifecycleEventObserver(observer, Formats.formatAsStackTraceElement(method.getJavaMember())); } if (method.isStatic()) { throw EventLogger.LOG.staticContainerLifecycleEventObserver(observer, Formats.formatAsStackTraceElement(method.getJavaMember())); } } observerMethodInitializers.add(observerMethodInitializer); }
@Override public void processMethod(EnhancedAnnotatedMethod<?, ? super T> method) { if (method.isAnnotationPresent(Inject.class)) { if (method.getAnnotation(Produces.class) != null) { throw UtilLogger.LOG.initializerCannotBeProducer(method, Formats.formatAsStackTraceElement(method.getJavaMember())); } else if (method.getEnhancedParameters(Disposes.class).size() > 0) { throw UtilLogger.LOG.initializerCannotBeDisposalMethod(method, Formats.formatAsStackTraceElement(method.getJavaMember())); } else if (method.getEnhancedParameters(Observes.class).size() > 0) { throw EventLogger.LOG.invalidInitializer(method, Formats.formatAsStackTraceElement(method.getJavaMember())); } else if (method.isGeneric()) { throw UtilLogger.LOG.initializerMethodIsGeneric(method, Formats.formatAsStackTraceElement(method.getJavaMember())); } if (!method.isStatic()) { currentLevel.add(InjectionPointFactory.instance().createMethodInjectionPoint(MethodInjectionPointType.INITIALIZER, method, declaringBean, type.getJavaClass(), null, manager)); } } }