/** * Creates a new invocation handler with supplier which provides a current injected value in proper scope. * * @param supplier provider of the value. */ private ThreadScopeBeanInstance(Supplier<T> supplier, Bean<T> bean, String contextId) { super(bean, new StringBeanIdentifier(((PassivationCapable) bean).getId()), contextId); this.supplier = supplier; }
@Override public BeanIdentifier getIdentifier() { // this will likely never get called, so it's ok to create new object here return new StringBeanIdentifier(id); }
@Override public BeanIdentifier getIdentifier() { // this will likely never get called, so it's ok to create new object here return new StringBeanIdentifier(id); }
/** * Creates a simple, annotation defined Enterprise Web Bean using the annotations specified on type * * @param <T> The type * @param beanManager the current manager * @param type the AnnotatedType to use * @return An Enterprise Web Bean */ public static <T> SessionBean<T> of(BeanAttributes<T> attributes, InternalEjbDescriptor<T> ejbDescriptor, BeanManagerImpl beanManager, EnhancedAnnotatedType<T> type) { return new SessionBean<T>(attributes, type, ejbDescriptor, new StringBeanIdentifier(BeanIdentifiers.forSessionBean(type, ejbDescriptor)), beanManager); }
/** * Given a particular id, return the correct contextual. For contextuals * which aren't passivation capable, the contextual can't be found in another * container, and null will be returned. * * @param id An identifier for the contextual * @return the contextual */ public <C extends Contextual<I>, I> C getContextual(String id) { return this.<C, I>getContextual(new StringBeanIdentifier(id)); }
/** * Given a particular id, return the correct contextual. For contextuals * which aren't passivation capable, the contextual can't be found in another * container, and null will be returned. * * @param id An identifier for the contextual * @return the contextual */ public <C extends Contextual<I>, I> C getContextual(String id) { return this.<C, I>getContextual(new StringBeanIdentifier(id)); }
/** * Given a particular id, return the correct contextual. For contextuals * which aren't passivation capable, the contextual can't be found in another * container, and null will be returned. * * @param id An identifier for the contextual * @return the contextual */ public <C extends Contextual<I>, I> C getContextual(String id) { return this.<C, I>getContextual(new StringBeanIdentifier(id)); }
public ProxyMethodHandler(String contextId, BeanInstance beanInstance, Bean<?> bean) { this.beanInstance = beanInstance; this.bean = bean; this.contextId = contextId; if (bean instanceof CommonBean<?>) { this.beanId = ((CommonBean<?>) bean).getIdentifier(); } else if (bean instanceof PassivationCapable) { this.beanId = new StringBeanIdentifier(((PassivationCapable) bean).getId()); } else { this.beanId = null; } }
public ProxyMethodHandler(String contextId, BeanInstance beanInstance, Bean<?> bean) { this.beanInstance = beanInstance; this.bean = bean; this.contextId = contextId; if (bean instanceof CommonBean<?>) { this.beanId = ((CommonBean<?>) bean).getIdentifier(); } else if (bean instanceof PassivationCapable) { this.beanId = new StringBeanIdentifier(((PassivationCapable) bean).getId()); } else { this.beanId = null; } }
private static BeanIdentifier createId(BeanAttributes<?> attributes, EnhancedAnnotatedMethod<?, ?> method, AbstractClassBean<?> declaringBean) { if (Dependent.class.equals(attributes.getScope()) || ApplicationScoped.class.equals(attributes.getScope())) { return new ProducerMethodIdentifier(method, declaringBean); } else { return new StringBeanIdentifier(BeanIdentifiers.forProducerMethod(method, declaringBean)); } }
private static BeanIdentifier createId(BeanAttributes<?> attributes, EnhancedAnnotatedType<?> clazz) { if (Dependent.class.equals(attributes.getScope()) || ApplicationScoped.class.equals(attributes.getScope())) { return new ManagedBeanIdentifier(clazz.slim().getIdentifier()); } else { return new StringBeanIdentifier(forManagedBean(clazz)); } }
/** * Creates an instance of a NewEnterpriseBean from an annotated class * * @param clazz The annotated class * @param beanManager The Bean manager * @return a new NewEnterpriseBean instance */ public static <T> NewSessionBean<T> of(BeanAttributes<T> attributes, InternalEjbDescriptor<T> ejbDescriptor, BeanManagerImpl beanManager) { EnhancedAnnotatedType<T> type = beanManager.getServices().get(ClassTransformer.class).getEnhancedAnnotatedType(ejbDescriptor.getBeanClass(), beanManager.getId()); return new NewSessionBean<T>(attributes, type, ejbDescriptor, new StringBeanIdentifier(BeanIdentifiers.forNewSessionBean(ejbDescriptor)), beanManager); }
private static BeanIdentifier createId(BeanAttributes<?> attributes, EnhancedAnnotatedType<?> clazz) { if (Dependent.class.equals(attributes.getScope()) || ApplicationScoped.class.equals(attributes.getScope())) { return new ManagedBeanIdentifier(clazz.slim().getIdentifier()); } else { return new StringBeanIdentifier(forManagedBean(clazz)); } }
private static BeanIdentifier createId(BeanAttributes<?> attributes, EnhancedAnnotatedType<?> clazz) { if (Dependent.class.equals(attributes.getScope()) || ApplicationScoped.class.equals(attributes.getScope())) { return new ManagedBeanIdentifier(clazz.slim().getIdentifier()); } else { return new StringBeanIdentifier(forManagedBean(clazz)); } }
protected InterceptorImpl(BeanAttributes<T> attributes, EnhancedAnnotatedType<T> type, BeanManagerImpl beanManager) { super(attributes, type, new StringBeanIdentifier(forInterceptor(type)), beanManager); this.interceptorMetadata = initInterceptorMetadata(); this.serializable = type.isSerializable(); this.interceptorBindingTypes = Collections.unmodifiableSet(new HashSet<Annotation>(Interceptors.mergeBeanInterceptorBindings(beanManager, getEnhancedAnnotated(), getStereotypes()).values())); if (Beans.findInterceptorBindingConflicts(beanManager, interceptorBindingTypes)) { throw new DeploymentException(BeanLogger.LOG.conflictingInterceptorBindings(getType())); } }
protected InterceptorImpl(BeanAttributes<T> attributes, EnhancedAnnotatedType<T> type, BeanManagerImpl beanManager) { super(attributes, type, new StringBeanIdentifier(forInterceptor(type)), beanManager); this.interceptorMetadata = initInterceptorMetadata(); this.serializable = type.isSerializable(); this.interceptorBindingTypes = Interceptors.mergeBeanInterceptorBindings(beanManager, getEnhancedAnnotated(), getStereotypes()).uniqueValues(); }
public ContextBean(ContextHolder<T> contextHolder, BeanManagerImpl beanManager) { super(new StringBeanIdentifier(BeanIdentifiers.forBuiltInBean(beanManager, contextHolder.getType(), null)), beanManager, contextHolder.getType()); this.context = contextHolder.getContext(); this.types = HierarchyDiscovery.forNormalizedType(contextHolder.getType()).getTypeClosure(); this.qualifiers = contextHolder.getQualifiers(); }
public ExtensionBean(BeanManagerImpl manager, EnhancedAnnotatedType<E> enhancedAnnotatedType, Metadata<E> instance) { super(new StringBeanIdentifier(BeanIdentifiers.forExtension(enhancedAnnotatedType)), manager, enhancedAnnotatedType.getJavaClass()); this.annotatedType = enhancedAnnotatedType.slim(); this.instance = instance; this.passivationCapable = enhancedAnnotatedType.isSerializable(); this.proxiable = Proxies.isTypeProxyable(enhancedAnnotatedType.getBaseType(), manager.getServices()); checkPublicFields(enhancedAnnotatedType); }
public ExtensionBean(BeanManagerImpl manager, EnhancedAnnotatedType<E> enhancedAnnotatedType, Metadata<E> instance) { super(new StringBeanIdentifier(BeanIdentifiers.forExtension(enhancedAnnotatedType)), manager, enhancedAnnotatedType.getJavaClass()); this.annotatedType = enhancedAnnotatedType.slim(); this.instance = instance; this.passivationCapable = enhancedAnnotatedType.isSerializable(); this.proxiable = Proxies.isTypeProxyable(enhancedAnnotatedType.getBaseType(), manager.getServices()); checkPublicFields(enhancedAnnotatedType); }
public ExtensionBean(BeanManagerImpl manager, EnhancedAnnotatedType<E> enhancedAnnotatedType, Metadata<E> instance) { super(new StringBeanIdentifier(BeanIdentifiers.forExtension(enhancedAnnotatedType)), manager, enhancedAnnotatedType.getJavaClass()); this.annotatedType = enhancedAnnotatedType.slim(); this.instance = instance; this.passivationCapable = enhancedAnnotatedType.isSerializable(); this.proxiable = Proxies.isTypeProxyable(enhancedAnnotatedType.getBaseType(), manager.getServices()); checkPublicFields(enhancedAnnotatedType); }