/* package */ InjectionResolver<?> getInjectionResolverForInjectee(SystemInjecteeImpl injectee) { return injecteeToResolverCache.compute(injectee); }
/* package */ InjectionResolver<?> getInjectionResolverForInjectee(SystemInjecteeImpl injectee) { return injecteeToResolverCache.compute(injectee); }
/* package */ InjectionResolver<?> getInjectionResolverForInjectee(SystemInjecteeImpl injectee) { return injecteeToResolverCache.compute(injectee); }
/* package */ InjectionResolver<?> getInjectionResolverForInjectee(SystemInjecteeImpl injectee) { return injecteeToResolverCache.compute(injectee); }
/* package */ Context<?> resolveContext(Class<? extends Annotation> scope) throws IllegalStateException { if (scope.equals(Singleton.class)) return singletonContext; if (scope.equals(PerLookup.class)) return perLookupContext; Context<?> retVal = contextCache.compute(scope); if (retVal.isActive()) return retVal; // Not active anymore, maybe there is another. But first, clear the cache! contextCache.remove(scope); return contextCache.compute(scope); }
/* package */ Context<?> resolveContext(Class<? extends Annotation> scope) throws IllegalStateException { if (scope.equals(Singleton.class)) return singletonContext; if (scope.equals(PerLookup.class)) return perLookupContext; Context<?> retVal = contextCache.compute(scope); if (retVal.isActive()) return retVal; // Not active anymore, maybe there is another. But first, clear the cache! contextCache.remove(scope); return contextCache.compute(scope); }
/* package */ Context<?> resolveContext(Class<? extends Annotation> scope) throws IllegalStateException { if (scope.equals(Singleton.class)) return singletonContext; if (scope.equals(PerLookup.class)) return perLookupContext; Context<?> retVal = contextCache.compute(scope); if (retVal.isActive()) return retVal; // Not active anymore, maybe there is another. But first, clear the cache! contextCache.remove(scope); return contextCache.compute(scope); }
/* package */ Context<?> resolveContext(Class<? extends Annotation> scope) throws IllegalStateException { if (scope.equals(Singleton.class)) return singletonContext; if (scope.equals(PerLookup.class)) return perLookupContext; Context<?> retVal = contextCache.compute(scope); if (retVal.isActive()) return retVal; // Not active anymore, maybe there is another. But first, clear the cache! contextCache.remove(scope); return contextCache.compute(scope); }
@SuppressWarnings("unchecked") @Override public <T> T findOrCreate(ActiveDescriptor<T> activeDescriptor, ServiceHandle<?> root) { try { return (T)valueCache.compute(new ContextualInput<Object>((ActiveDescriptor<Object>) activeDescriptor, root)); } catch (Throwable th) { if (th instanceof MultiException) { throw (MultiException) th; } throw new MultiException(th); } }
@SuppressWarnings("unchecked") @Override public <T> T findOrCreate(ActiveDescriptor<T> activeDescriptor, ServiceHandle<?> root) { try { return (T)valueCache.compute(new ContextualInput<Object>((ActiveDescriptor<Object>) activeDescriptor, root)); } catch (Throwable th) { if (th instanceof MultiException) { throw (MultiException) th; } throw new MultiException(th); } }
@SuppressWarnings("unchecked") @Override public <T> T findOrCreate(ActiveDescriptor<T> activeDescriptor, ServiceHandle<?> root) { try { return (T)valueCache.compute(new ContextualInput<Object>((ActiveDescriptor<Object>) activeDescriptor, root)); } catch (Throwable th) { if (th instanceof MultiException) { throw (MultiException) th; } throw new MultiException(th); } }
@SuppressWarnings("unchecked") @Override public <T> T findOrCreate(ActiveDescriptor<T> activeDescriptor, ServiceHandle<?> root) { try { return (T)valueCache.compute(new ContextualInput<Object>((ActiveDescriptor<Object>) activeDescriptor, root)); } catch (Throwable th) { if (th instanceof MultiException) { throw (MultiException) th; } throw new MultiException(th); } }
@Override public Object provide() { final Class<?> rawType = parameter.getRawType(); final Object fromHk2 = locator.getService(rawType); if (fromHk2 != null) { // the bean parameter type is already bound in HK2, let's just take it from there return fromHk2; } ActiveDescriptor<?> reifiedDescriptor = descriptorCache.compute(rawType); return locator.getServiceHandle(reifiedDescriptor).getService(); } }
@Override public Object provide() { final Class<?> rawType = parameter.getRawType(); final Object fromHk2 = locator.getService(rawType); if (fromHk2 != null) { // the bean parameter type is already bound in HK2, let's just take it from there return fromHk2; } ActiveDescriptor<?> reifiedDescriptor = descriptorCache.compute(rawType); return locator.getServiceHandle(reifiedDescriptor).getService(); } }
@Override public Object provide() { final Class<?> rawType = parameter.getRawType(); final Object fromHk2 = locator.getService(rawType); if (fromHk2 != null) { // the bean parameter type is already bound in HK2, let's just take it from there return fromHk2; } ActiveDescriptor<?> reifiedDescriptor = descriptorCache.compute(rawType); return locator.getServiceHandle(reifiedDescriptor).getService(); } }
private static Injectee getInjectee(final Parameter parameter) { return new InjecteeImpl() { private final Class<?> rawType = parameter.getRawType(); { setRequiredType(parameter.getType()); setRequiredQualifiers(Collections.<Annotation>emptySet()); final ActiveDescriptor proxyDescriptor = descriptorCache.compute(parameter); if (proxyDescriptor != null) { setInjecteeDescriptor(proxyDescriptor); } } @Override public Class<?> getInjecteeClass() { return rawType; } }; }
private static Injectee getInjectee(final Parameter parameter) { return new InjecteeImpl() { private final Class<?> rawType = parameter.getRawType(); { setRequiredType(parameter.getType()); setRequiredQualifiers(Collections.<Annotation>emptySet()); final ActiveDescriptor proxyDescriptor = descriptorCache.compute(parameter); if (proxyDescriptor != null) { setInjecteeDescriptor(proxyDescriptor); } } @Override public Class<?> getInjecteeClass() { return rawType; } }; }
private static Injectee getInjectee(final Parameter parameter) { return new InjecteeImpl() { private final Class<?> rawType = parameter.getRawType(); { setRequiredType(parameter.getType()); setRequiredQualifiers(Collections.<Annotation>emptySet()); final ActiveDescriptor proxyDescriptor = descriptorCache.compute(parameter); if (proxyDescriptor != null) { setInjecteeDescriptor(proxyDescriptor); } } @Override public Class<?> getInjecteeClass() { return rawType; } }; }
@Override public Object resolve(Injectee injectee, ServiceHandle<?> root) { Type requiredType = injectee.getRequiredType(); boolean isHk2Factory = ReflectionHelper.isSubClassOf(requiredType, Factory.class); Injectee newInjectee; if (isHk2Factory) { newInjectee = getFactoryInjectee(injectee, ReflectionHelper.getTypeArgument(requiredType, 0)); } else { newInjectee = foreignRequestScopedInjecteeCache.compute(injectee); } ActiveDescriptor<?> ad = descriptorCache.compute(newInjectee); if (ad != null) { final ServiceHandle handle = serviceLocator.getServiceHandle(ad, newInjectee); if (isHk2Factory) { return asFactory(handle); } else { return handle.getService(); } } return null; }
@Override public Object resolve(Injectee injectee, ServiceHandle<?> root) { Type requiredType = injectee.getRequiredType(); boolean isHk2Factory = ReflectionHelper.isSubClassOf(requiredType, Factory.class); Injectee newInjectee; if (isHk2Factory) { newInjectee = getFactoryInjectee(injectee, ReflectionHelper.getTypeArgument(requiredType, 0)); } else { newInjectee = foreignRequestScopedInjecteeCache.compute(injectee); } ActiveDescriptor<?> ad = descriptorCache.compute(newInjectee); if (ad != null) { final ServiceHandle handle = serviceLocator.getServiceHandle(ad, newInjectee); if (isHk2Factory) { return asFactory(handle); } else { return handle.getService(); } } return null; }