static ActiveDescriptor<?> translateToActiveDescriptor(ClassBinding<?> desc) { ActiveDescriptorBuilder binding = BuilderHelper.activeLink(desc.getService()).named(desc.getName()) .analyzeWith(desc.getAnalyzer()); if (desc.getScope() != null) { binding.in(transformScope(desc.getScope())); } if (desc.getRank() != null) { binding.ofRank(desc.getRank()); } for (Annotation annotation : desc.getQualifiers()) { binding.qualifiedBy(annotation); } for (Type contract : desc.getContracts()) { binding.to(contract); } if (desc.isProxiable() != null) { binding.proxy(desc.isProxiable()); } if (desc.isProxiedForSameScope() != null) { binding.proxyForSameScope(desc.isProxiedForSameScope()); } if (desc.getImplementationType() != null) { binding.asType(desc.getImplementationType()); } return binding.build(); }
@Override public Injectee apply(CacheKey cacheKey) { Injectee injectee = cacheKey.getInjectee(); if (injectee.getParent() != null) { if (Field.class.isAssignableFrom(injectee.getParent().getClass())) { Field f = (Field) injectee.getParent(); if (foreignRequestScopedComponents.get().contains(f.getDeclaringClass())) { final Class<?> clazz = f.getType(); if (serviceLocator.getServiceHandle(clazz).getActiveDescriptor().getScopeAnnotation() == RequestScoped.class) { final AbstractActiveDescriptor<Object> descriptor = BuilderHelper.activeLink(clazz) .to(clazz) .in(RequestScoped.class) .build(); return new DescriptorOverridingInjectee(injectee, descriptor); } } } } return injectee; } });
@Override public Injectee apply(CacheKey cacheKey) { Injectee injectee = cacheKey.getInjectee(); if (injectee.getParent() != null) { if (Field.class.isAssignableFrom(injectee.getParent().getClass())) { Field f = (Field) injectee.getParent(); if (foreignRequestScopedComponents.get().contains(f.getDeclaringClass())) { final Class<?> clazz = f.getType(); if (serviceLocator.getServiceHandle(clazz).getActiveDescriptor().getScopeAnnotation() == RequestScoped.class) { final AbstractActiveDescriptor<Object> descriptor = BuilderHelper.activeLink(clazz) .to(clazz) .in(RequestScoped.class) .build(); return new DescriptorOverridingInjectee(injectee, descriptor); } } } } return injectee; } });
static ActiveDescriptor<?> translateToActiveDescriptor(ClassBinding<?> desc) { ActiveDescriptorBuilder binding = BuilderHelper.activeLink(desc.getService()).named(desc.getName()) .analyzeWith(desc.getAnalyzer()); if (desc.getScope() != null) { binding.in(transformScope(desc.getScope())); } if (desc.getRank() != null) { binding.ofRank(desc.getRank()); } for (Annotation annotation : desc.getQualifiers()) { binding.qualifiedBy(annotation); } for (Type contract : desc.getContracts()) { binding.to(contract); } if (desc.isProxiable() != null) { binding.proxy(desc.isProxiable()); } if (desc.isProxiedForSameScope() != null) { binding.proxyForSameScope(desc.isProxiedForSameScope()); } if (desc.getImplementationType() != null) { binding.asType(desc.getImplementationType()); } return binding.build(); }
@Override public ActiveDescriptor<?> compute(Class<?> key) { // below we make sure HK2 behaves as if injection happens into a request scoped type // this is to avoid having proxies injected (see JERSEY-2386) // before touching the following statement, check BeanParamMemoryLeakTest first! final AbstractActiveDescriptor<Object> descriptor = BuilderHelper.activeLink(key).to(key).in(RequestScoped.class).build(); return ServiceLocatorUtilities.addOneDescriptor(locator, descriptor, false); } });
.named(name) .andLoadWith(this.loader) .analyzeWith(this.analyzer); builder.in(scopeAnnotation); builder.in(scope); builder.ofRank(ranked); builder.has(key, value); builder.qualifiedBy(annotation); builder.to(contract); builder.proxy(proxiable); builder.proxyForSameScope(proxyForSameScope); configuration.bind(builder.build(), false);
@Override public ActiveDescriptor<?> compute(Class<?> key) { // below we make sure HK2 behaves as if injection happens into a request scoped type // this is to avoid having proxies injected (see JERSEY-2386) // before touching the following statement, check BeanParamMemoryLeakTest first! final AbstractActiveDescriptor<Object> descriptor = BuilderHelper.activeLink(key).to(key).in(RequestScoped.class).build(); return ServiceLocatorUtilities.addOneDescriptor(locator, descriptor, false); } });
.named(name) .andLoadWith(this.loader) .analyzeWith(this.analyzer); builder.in(scopeAnnotation); builder.in(scope); builder.ofRank(ranked); builder.has(key, value); builder.qualifiedBy(annotation); builder.to(contract); builder.proxy(proxiable); builder.proxyForSameScope(proxyForSameScope); builder.asType(implementationType); configuration.bind(builder.build(), false);
@Override public ActiveDescriptor<?> compute(Class<?> key) { // below we make sure HK2 behaves as if injection happens into a request scoped type // this is to avoid having proxies injected (see JERSEY-2386) // before touching the following statement, check BeanParamMemoryLeakTest first! final AbstractActiveDescriptor<Object> descriptor = BuilderHelper.activeLink(key).to(key).in(RequestScoped.class).build(); return ServiceLocatorUtilities.addOneDescriptor(locator, descriptor, false); } });
.named(name) .andLoadWith(this.loader) .analyzeWith(this.analyzer); builder.in(scopeAnnotation); builder.in(scope); builder.ofRank(ranked); builder.has(key, value); builder.qualifiedBy(annotation); builder.to(contract); builder.proxy(proxiable); builder.proxyForSameScope(proxyForSameScope); configuration.bind(builder.build(), false);
@Override public Injectee apply(CacheKey cacheKey) { Injectee injectee = cacheKey.getInjectee(); if (injectee.getParent() != null) { if (Field.class.isAssignableFrom(injectee.getParent().getClass())) { Field f = (Field) injectee.getParent(); if (foreignRequestScopedComponents.get().contains(f.getDeclaringClass())) { final Class<?> clazz = f.getType(); if (serviceLocator.getServiceHandle(clazz).getActiveDescriptor().getScopeAnnotation() == RequestScoped.class) { final AbstractActiveDescriptor<Object> descriptor = BuilderHelper.activeLink(clazz) .to(clazz) .in(RequestScoped.class) .build(); return new DescriptorOverridingInjectee(injectee, descriptor); } } } } return injectee; } });
.named(name) .andLoadWith(this.loader) .analyzeWith(this.analyzer); builder.in(scopeAnnotation); builder.in(scope); builder.ofRank(ranked); builder.has(key, value); builder.qualifiedBy(annotation); builder.to(contract); builder.proxy(proxiable); builder.proxyForSameScope(proxyForSameScope); configuration.bind(builder.build(), false);
@Override public Injectee compute(Injectee injectee) { if (injectee.getParent() != null) { if (Field.class.isAssignableFrom(injectee.getParent().getClass())) { Field f = (Field) injectee.getParent(); if (foreignRequestScopedComponents.get().contains(f.getDeclaringClass())) { final Class<?> clazz = f.getType(); if (serviceLocator.getServiceHandle(clazz).getActiveDescriptor().getScopeAnnotation() == RequestScoped.class) { final AbstractActiveDescriptor<Object> descriptor = BuilderHelper.activeLink(clazz) .to(clazz) .in(RequestScoped.class) .build(); return new DescriptorOverridingInjectee(injectee, descriptor); } } } } return injectee; } });
.named(name) .andLoadWith(this.loader) .analyzeWith(this.analyzer); factoryDescriptorBuilder.in(factoryScope); .named(name) .andLoadWith(this.loader) .analyzeWith(this.analyzer); descriptorBuilder.in(scope); descriptorBuilder.ofRank(ranked); factoryDescriptorBuilder.qualifiedBy(qualifier); descriptorBuilder.qualifiedBy(qualifier); factoryDescriptorBuilder.to(new ParameterizedTypeImpl(Factory.class, contract)); descriptorBuilder.to(contract); List<String> values = metadata.get(key); for (String value : values) { factoryDescriptorBuilder.has(key, value); descriptorBuilder.has(key, value); descriptorBuilder.proxy(proxiable); descriptorBuilder.proxyForSameScope(proxyForSameScope);
@Override public Injectee compute(Injectee injectee) { if (injectee.getParent() != null) { if (Field.class.isAssignableFrom(injectee.getParent().getClass())) { Field f = (Field) injectee.getParent(); if (foreignRequestScopedComponents.get().contains(f.getDeclaringClass())) { final Class<?> clazz = f.getType(); if (serviceLocator.getServiceHandle(clazz).getActiveDescriptor().getScopeAnnotation() == RequestScoped.class) { final AbstractActiveDescriptor<Object> descriptor = BuilderHelper.activeLink(clazz) .to(clazz) .in(RequestScoped.class) .build(); return new DescriptorOverridingInjectee(injectee, descriptor); } } } } return injectee; } });
.named(name) .andLoadWith(this.loader) .analyzeWith(this.analyzer); factoryDescriptorBuilder.in(factoryScope); .named(name) .andLoadWith(this.loader) .analyzeWith(this.analyzer); descriptorBuilder.in(scope); descriptorBuilder.ofRank(ranked); factoryDescriptorBuilder.qualifiedBy(qualifier); descriptorBuilder.qualifiedBy(qualifier); factoryDescriptorBuilder.to(new ParameterizedTypeImpl(Factory.class, contract)); descriptorBuilder.to(contract); List<String> values = metadata.get(key); for (String value : values) { factoryDescriptorBuilder.has(key, value); descriptorBuilder.has(key, value); descriptorBuilder.proxy(proxiable); descriptorBuilder.proxyForSameScope(proxyForSameScope);
@Override public Injectee compute(Injectee injectee) { if (injectee.getParent() != null) { if (Field.class.isAssignableFrom(injectee.getParent().getClass())) { Field f = (Field) injectee.getParent(); if (foreignRequestScopedComponents.get().contains(f.getDeclaringClass())) { final Class<?> clazz = f.getType(); if (serviceLocator.getServiceHandle(clazz).getActiveDescriptor().getScopeAnnotation() == RequestScoped.class) { final AbstractActiveDescriptor<Object> descriptor = BuilderHelper.activeLink(clazz) .to(clazz) .in(RequestScoped.class) .build(); return new DescriptorOverridingInjectee(injectee, descriptor); } } } } return injectee; } });
.named(name) .andLoadWith(this.loader) .analyzeWith(this.analyzer); factoryDescriptorBuilder.in(factoryScope); .named(name) .andLoadWith(this.loader) .analyzeWith(this.analyzer); descriptorBuilder.in(scope); descriptorBuilder.ofRank(ranked); factoryDescriptorBuilder.qualifiedBy(qualifier); descriptorBuilder.qualifiedBy(qualifier); factoryDescriptorBuilder.to(new ParameterizedTypeImpl(Factory.class, contract)); descriptorBuilder.to(contract); List<String> values = metadata.get(key); for (String value : values) { factoryDescriptorBuilder.has(key, value); descriptorBuilder.has(key, value); descriptorBuilder.proxy(proxiable); descriptorBuilder.proxyForSameScope(proxyForSameScope);
@Override public Injectee apply(CacheKey cacheKey) { Injectee injectee = cacheKey.getInjectee(); if (injectee.getParent() != null) { if (Field.class.isAssignableFrom(injectee.getParent().getClass())) { Field f = (Field) injectee.getParent(); if (foreignRequestScopedComponents.get().contains(f.getDeclaringClass())) { final Class<?> clazz = f.getType(); if (serviceLocator.getServiceHandle(clazz).getActiveDescriptor().getScopeAnnotation() == RequestScoped.class) { final AbstractActiveDescriptor<Object> descriptor = BuilderHelper.activeLink(clazz) .to(clazz) .in(RequestScoped.class) .build(); return new DescriptorOverridingInjectee(injectee, descriptor); } } } } return injectee; } });
.named(name) .andLoadWith(this.loader) .analyzeWith(this.analyzer); factoryDescriptorBuilder.in(factoryScope); .named(name) .andLoadWith(this.loader) .analyzeWith(this.analyzer); descriptorBuilder.in(scope); descriptorBuilder.ofRank(ranked); factoryDescriptorBuilder.qualifiedBy(qualifier); descriptorBuilder.qualifiedBy(qualifier); factoryDescriptorBuilder.to(new ParameterizedTypeImpl(Factory.class, contract)); descriptorBuilder.to(contract); List<String> values = metadata.get(key); for (String value : values) { factoryDescriptorBuilder.has(key, value); descriptorBuilder.has(key, value); descriptorBuilder.proxy(proxiable); descriptorBuilder.proxyForSameScope(proxyForSameScope);