private void checkNoArgsConstructor(EnhancedAnnotatedType<T> type) { if (!beanManager.getServices().get(ProxyInstantiator.class).isUsingConstructor()) { return; } EnhancedAnnotatedConstructor<T> constructor = type.getNoArgsEnhancedConstructor(); if (constructor == null) { throw BeanLogger.LOG.decoratedHasNoNoargsConstructor(this); } else if (constructor.isPrivate()) { throw BeanLogger.LOG .decoratedNoargsConstructorIsPrivate(this, Formats.formatAsStackTraceElement(constructor.getJavaMember())); } }
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); } } } }
/** * Creates a new constructor injection point suitable for Jersey components. * * @param constructor resolved constructor that can be injected using Jersey. * @param bean bean descriptor dedicated to the parent class. * @param manager current bean manager. * @param resolvers all registered resolvers. */ public JerseyConstructorInjectionPoint(EnhancedAnnotatedConstructor<T> constructor, Bean<T> bean, BeanManagerImpl manager, Collection<InjectionResolver> resolvers) { super(constructor, null, constructor.getJavaClass(), InjectionPointFactory.instance(), manager); List<InjecteeToSupplier> valueSuppliers = createValueSuppliers(constructor.getJavaMember(), getParameterInjectionPoints(), resolvers); /* * Caches either created proxies if the component class is not RequestScoped or caches the supplier that just create * values every component creates. */ if (proxyResolver.isPrixiable(bean.getScope())) { this.cachedProxies = generateProxies(valueSuppliers); } else { this.cachedSuppliers = valueSuppliers.stream() .map(is -> is.supplier) .collect(Collectors.toList()); } }
if (!eat.isAbstract() || !eat.getJavaClass().isInterface()) { // injectionTargetCannotBeCreatedForInterface ((AbstractClassBean)bean).setProducer(beanManager.getLocalInjectionTargetFactory(eat).createInjectionTarget(eat, bean, false)); if (isReinjectingContext(bean)) {
.getDeclaredEnhancedConstructor(new ConstructorSignatureImpl(analyzer.getConstructor()));
EnhancedAnnotatedType<T> type = transformer.getEnhancedAnnotatedType(clazz, beanManager.getId()); if (!type.getJavaClass().equals(componentClass)) {
private void buildInterceptionModel(EnhancedAnnotatedType<T> annotatedType, AbstractInstantiator<T> instantiator) { new InterceptionModelInitializer<>(beanManager, annotatedType, annotatedType.getDeclaredEnhancedConstructor( instantiator.getConstructorInjectionPoint().getSignature()), getBean()).init(); }
private boolean isSpecialParameter(EnhancedAnnotatedParameter<?, ?> parameter) { return parameter.isAnnotationPresent(Disposes.class) || parameter.isAnnotationPresent(Observes.class) || parameter.isAnnotationPresent(ObservesAsync.class); } }
/** * Initializes the default deployment type */ private void initAlternative(EnhancedAnnotation<T> annotatedAnnotation) { if (annotatedAnnotation.isAnnotationPresent(Alternative.class)) { this.alternative = true; } }
@Override public LazyValueHolder<Set<Type>> apply(Type input) { return new TypeClosureLazyValueHolder(input); } });
/** * Initializes the interceptor bindings */ private void initInterceptorBindings(EnhancedAnnotation<T> annotatedAnnotation) { interceptorBindings = annotatedAnnotation.getMetaAnnotations(InterceptorBinding.class); }
@Override public String toString() { return "InterceptionModelInitializer for " + annotatedType.getJavaClass(); } }
private static boolean initHasTransientReference(List<? extends EnhancedAnnotatedParameter<?, ?>> parameters) { for (EnhancedAnnotatedParameter<?, ?> parameter : parameters) { if (parameter.isAnnotationPresent(TransientReference.class)) { return true; } } return false; }
/** * Initializes the default deployment type */ private void initAlternative(EnhancedAnnotation<T> annotatedAnnotation) { if (annotatedAnnotation.isAnnotationPresent(Alternative.class)) { this.alternative = true; } }
@Override public LazyValueHolder<Set<Type>> apply(Type input) { return new TypeClosureLazyValueHolder(input); } });
/** * Initializes the interceptor bindings */ private void initInterceptorBindings(EnhancedAnnotation<T> annotatedAnnotation) { interceptorBindings = annotatedAnnotation.getMetaAnnotations(InterceptorBinding.class); }
private static boolean initHasTransientReference(List<? extends EnhancedAnnotatedParameter<?, ?>> parameters) { for (EnhancedAnnotatedParameter<?, ?> parameter : parameters) { if (parameter.isAnnotationPresent(TransientReference.class)) { return true; } } return false; }
/** * Initializes the default deployment type */ private void initAlternative(EnhancedAnnotation<T> annotatedAnnotation) { if (annotatedAnnotation.isAnnotationPresent(Alternative.class)) { this.alternative = true; } }
@Override public LazyValueHolder<Set<Type>> apply(Type input) { return new TypeClosureLazyValueHolder(input); } });
private static boolean initHasTransientReference(List<? extends EnhancedAnnotatedParameter<?, ?>> parameters) { for (EnhancedAnnotatedParameter<?, ?> parameter : parameters) { if (parameter.isAnnotationPresent(TransientReference.class)) { return true; } } return false; }