@Override public Object invoke(Object obj, Method method, Object... arguments) throws Throwable { Object instance = instances.computeIfAbsent(Thread.currentThread(), thread -> supplier.get()); return super.invoke(instance, method, arguments); }
private Object readResolve() throws ObjectStreamException { Bean<T> bean = Container.instance(contextId).services().get(ContextualStore.class).<Bean<T>, T>getContextual(id); return new ContextBeanInstance<T>(bean, id, contextId); }
/** * Creates a new locator for instances of the given bean. * * @param bean The contextual bean * @param id The unique identifier of this bean */ public ContextBeanInstance(Bean<T> bean, BeanIdentifier id, String contextId) { this.bean = bean; this.id = id; this.contextId = contextId; this.instanceType = computeInstanceType(bean); BeanLogger.LOG.createdContextInstance(bean, id); this.manager = Container.instance(contextId).deploymentManager(); this.currentInjectionPoint = manager.getServices().get(CurrentInjectionPoint.class); }
private Object readResolve() throws ObjectStreamException { Bean<T> bean = Container.instance(contextId).services().get(ContextualStore.class).<Bean<T>, T>getContextual(id); return new ContextBeanInstance<T>(bean, id, contextId); }
/** * Creates a new locator for instances of the given bean. * * @param bean The contextual bean * @param id The unique identifier of this bean */ public ContextBeanInstance(Bean<T> bean, BeanIdentifier id, String contextId) { this.bean = bean; this.id = id; this.contextId = contextId; this.instanceType = computeInstanceType(bean); BeanLogger.LOG.createdContextInstance(bean, id); this.manager = Container.instance(contextId).deploymentManager(); this.currentInjectionPoint = manager.getServices().get(CurrentInjectionPoint.class); }
private Object readResolve() throws ObjectStreamException { Bean<T> bean = Container.instance(contextId).services().get(ContextualStore.class).<Bean<T>, T>getContextual(id); return new ContextBeanInstance<T>(bean, id, contextId); }
/** * Creates a new locator for instances of the given bean. * * @param bean The contextual bean * @param id The unique identifier of this bean */ public ContextBeanInstance(Bean<T> bean, BeanIdentifier id, String contextId) { this.bean = bean; this.id = id; this.contextId = contextId; this.instanceType = computeInstanceType(bean); BeanLogger.LOG.createdContextInstance(bean, id); this.manager = Container.instance(contextId).deploymentManager(); this.currentInjectionPoint = manager.getServices().get(CurrentInjectionPoint.class); }
private Object readResolve() throws ObjectStreamException { Bean<T> bean = Container.instance(contextId).services().get(ContextualStore.class).<Bean<T>, T>getContextual(id); return new ContextBeanInstance<T>(bean, id, contextId); }
/** * Creates a new locator for instances of the given bean. * * @param bean The contextual bean * @param id The unique identifier of this bean */ public ContextBeanInstance(Bean<T> bean, BeanIdentifier id, String contextId) { this.bean = bean; this.id = id; this.contextId = contextId; this.instanceType = computeInstanceType(bean); BeanLogger.LOG.createdContextInstance(bean, id); this.manager = Container.instance(contextId).deploymentManager(); this.currentInjectionPoint = manager.getServices().get(CurrentInjectionPoint.class); }
private Object readResolve() throws ObjectStreamException { Bean<T> bean = Container.instance(contextId).services().get(ContextualStore.class).<Bean<T>, T>getContextual(id); return new ContextBeanInstance<T>(bean, id, contextId); }
/** * Creates a new locator for instances of the given bean. * * @param bean The contextual bean * @param id The unique identifier of this bean */ public ContextBeanInstance(Bean<T> bean, BeanIdentifier id, String contextId) { this.bean = bean; this.id = id; this.contextId = contextId; this.instanceType = computeInstanceType(bean); BeanLogger.LOG.createdContextInstance(bean, id); this.manager = Container.instance(contextId).deploymentManager(); this.currentInjectionPoint = manager.getServices().get(CurrentInjectionPoint.class); }
private Object readResolve() throws ObjectStreamException { Bean<T> bean = Container.instance(contextId).services().get(ContextualStore.class).<Bean<T>, T>getContextual(id); return new ContextBeanInstance<T>(bean, id, contextId); }
/** * Creates a new locator for instances of the given bean. * * @param bean The contextual bean * @param id The unique identifier of this bean */ public ContextBeanInstance(Bean<T> bean, BeanIdentifier id, String contextId) { this.bean = bean; this.id = id; this.contextId = contextId; this.instanceType = computeInstanceType(bean); BeanLogger.LOG.createdContextInstance(bean, id); this.manager = Container.instance(contextId).deploymentManager(); this.currentInjectionPoint = manager.getServices().get(CurrentInjectionPoint.class); }
private <T> T createClientProxy(Bean<T> bean, Set<Type> types) { BeanIdentifier id = Container.instance(contextId).services().get(ContextualStore.class).putIfAbsent(bean); if (id == null) { throw BeanLogger.LOG.beanIdCreationFailed(bean); } BeanInstance beanInstance = new ContextBeanInstance<T>(bean, id, contextId); TypeInfo typeInfo = TypeInfo.of(types); T proxy = new ClientProxyFactory<T>(contextId, typeInfo.getSuperClass(), types, bean).create(beanInstance); BeanLogger.LOG.createdNewClientProxyType(proxy.getClass(), bean, id); return proxy; }
private <T> T createClientProxy(Bean<T> bean, Set<Type> types) { BeanIdentifier id = Container.instance(contextId).services().get(ContextualStore.class).putIfAbsent(bean); if (id == null) { throw BeanLogger.LOG.beanIdCreationFailed(bean); } BeanInstance beanInstance = new ContextBeanInstance<T>(bean, id, contextId); TypeInfo typeInfo = TypeInfo.of(types); T proxy = new ClientProxyFactory<T>(contextId, typeInfo.getSuperClass(), types, bean).create(beanInstance); BeanLogger.LOG.createdNewClientProxyType(proxy.getClass(), bean, id); return proxy; }
private <T> T createClientProxy(Bean<T> bean, Set<Type> types) { BeanIdentifier id = Container.instance(contextId).services().get(ContextualStore.class).putIfAbsent(bean); if (id == null) { throw BeanLogger.LOG.beanIdCreationFailed(bean); } BeanInstance beanInstance = new ContextBeanInstance<T>(bean, id, contextId); TypeInfo typeInfo = TypeInfo.of(types); T proxy = new ClientProxyFactory<T>(contextId, typeInfo.getSuperClass(), types, bean).create(beanInstance); BeanLogger.LOG.createdNewClientProxyType(proxy.getClass(), bean, id); return proxy; }
private <T> T createClientProxy(Bean<T> bean, Set<Type> types) { BeanIdentifier id = Container.instance(contextId).services().get(ContextualStore.class).putIfAbsent(bean); if (id == null) { throw BeanLogger.LOG.beanIdCreationFailed(bean); } BeanInstance beanInstance = new ContextBeanInstance<T>(bean, id, contextId); TypeInfo typeInfo = TypeInfo.of(types); T proxy = new ClientProxyFactory<T>(contextId, typeInfo.getSuperClass(), types, bean).create(beanInstance); BeanLogger.LOG.createdNewClientProxyType(proxy.getClass(), bean, id); return proxy; }
private <T> T createClientProxy(Bean<T> bean, Set<Type> types) { BeanIdentifier id = Container.instance(contextId).services().get(ContextualStore.class).putIfAbsent(bean); if (id == null) { throw BeanLogger.LOG.beanIdCreationFailed(bean); } BeanInstance beanInstance = new ContextBeanInstance<T>(bean, id, contextId); TypeInfo typeInfo = TypeInfo.of(types); T proxy = new ClientProxyFactory<T>(contextId, typeInfo.getSuperClass(), types, bean).create(beanInstance); BeanLogger.LOG.createdNewClientProxyType(proxy.getClass(), bean, id); return proxy; }
private <T> T createClientProxy(Bean<T> bean, Set<Type> types) { BeanIdentifier id = Container.instance(contextId).services().get(ContextualStore.class).putIfAbsent(bean); if (id == null) { throw BeanLogger.LOG.beanIdCreationFailed(bean); } BeanInstance beanInstance = new ContextBeanInstance<T>(bean, id, contextId); TypeInfo typeInfo = TypeInfo.of(types); T proxy = new ClientProxyFactory<T>(contextId, typeInfo.getSuperClass(), types, bean).create(beanInstance); BeanLogger.LOG.createdNewClientProxyType(proxy.getClass(), bean, id); return proxy; }