@Override public Object resolve(Injectee injectee, ServiceHandle<?> root) { InjectionResolver<?> resolver = descriptor.create(root); return resolver.resolve(injectee, root); } }
@Override public Object resolve(Injectee injectee, ServiceHandle<?> root) { InjectionResolver<?> resolver = descriptor.create(root); return resolver.resolve(injectee, root); } }
Object findThreeThirtyService(Injectee injectee, ServiceHandle root) { //TODO: we need to be able to get the asutal injectee resolver for types //other than @Inject. HK2 no longer provides ability to do that via API //will file a bug. InjectionResolver threeThirtyResolver = serviceLocator.getService(InjectionResolver.class, SYSTEM_RESOLVER_NAME); return threeThirtyResolver.resolve(injectee, root); }
@Override public Object resolve(Injectee injectee, ServiceHandle<?> root) { InjectionResolver<?> resolver = descriptor.create(root); return resolver.resolve(injectee, root); } }
@Override public Object resolve(Injectee injectee, ServiceHandle<?> root) { InjectionResolver<?> resolver = descriptor.create(root); return resolver.resolve(injectee, root); } }
Object findThreeThirtyService(Injectee injectee, ServiceHandle root) { //TODO: we need to be able to get the asutal injectee resolver for types //other than @Inject. HK2 no longer provides ability to do that via API //will file a bug. InjectionResolver threeThirtyResolver = injectionManager.getInstance( InjectionResolver.class, new NamedImpl(SYSTEM_RESOLVER_NAME) ); return threeThirtyResolver.resolve(injectee, root); }
private void resolve(Map<SystemInjecteeImpl, Object> addToMe, InjectionResolver<?> resolver, SystemInjecteeImpl injectee, ServiceHandle<?> root, Collector errorCollection) { if (injectee.isSelf()) { addToMe.put(injectee, selfDescriptor); return; } Object addIn = null; try { addIn = resolver.resolve(injectee, root); } catch (Throwable th) { errorCollection.addThrowable(th); } if (addIn != null) { addToMe.put(injectee, addIn); } }
private void resolve(Map<SystemInjecteeImpl, Object> addToMe, InjectionResolver<?> resolver, SystemInjecteeImpl injectee, ServiceHandle<?> root, Collector errorCollection) { if (injectee.isSelf()) { addToMe.put(injectee, selfDescriptor); return; } Object addIn = null; try { addIn = resolver.resolve(injectee, root); } catch (Throwable th) { errorCollection.addThrowable(th); } if (addIn != null) { addToMe.put(injectee, addIn); } }
private void resolve(Map<SystemInjecteeImpl, Object> addToMe, InjectionResolver<?> resolver, SystemInjecteeImpl injectee, ServiceHandle<?> root, Collector errorCollection) { if (injectee.isSelf()) { addToMe.put(injectee, selfDescriptor); return; } Object addIn = null; try { addIn = resolver.resolve(injectee, root); } catch (Throwable th) { errorCollection.addThrowable(th); } if (addIn != null) { addToMe.put(injectee, addIn); } }
private void resolve(Map<SystemInjecteeImpl, Object> addToMe, InjectionResolver<?> resolver, SystemInjecteeImpl injectee, ServiceHandle<?> root, Collector errorCollection) { if (injectee.isSelf()) { addToMe.put(injectee, selfDescriptor); return; } Object addIn = null; try { addIn = resolver.resolve(injectee, root); } catch (Throwable th) { errorCollection.addThrowable(th); } if (addIn != null) { addToMe.put(injectee, addIn); } }
@Override public Object resolve(Injectee injectee, ServiceHandle<?> root) { Type type = injectee.getRequiredType(); AssistedResolver resolver = null; if (type instanceof Class) { TypedImpl namedType = new TypedImpl((Class) type); resolver = assistedResolvers.qualifiedWith(namedType).get(); } if (resolver == null) { return systemResolver.resolve(injectee, root); } return resolver.resolve(injectee, root) .orElseGet(() -> systemResolver.resolve(injectee, root)); }
args[lcv] = resolver.resolve(injectee, root);
/** * Just creates the thing, doesn't try to do anything else * @param createMe The thing to create * @param locator The locator to find the injection points with * @param strategy The strategy to use for analyzing the class * @return The constructed thing, no further injection is performed */ @SuppressWarnings("unchecked") public static <T> T justCreate(Class<T> createMe, ServiceLocatorImpl locator, String strategy) { if (createMe == null) throw new IllegalArgumentException(); Collector collector = new Collector(); ClassAnalyzer analyzer = getClassAnalyzer(locator, strategy, collector); collector.throwIfErrors(); Constructor<?> c = getConstructor(createMe, analyzer, collector); collector.throwIfErrors(); List<SystemInjecteeImpl> injectees = getConstructorInjectees(c, null); validateSelfInjectees(null, injectees, collector); collector.throwIfErrors(); Object args[] = new Object[injectees.size()]; for (SystemInjecteeImpl injectee : injectees) { InjectionResolver<?> resolver = locator.getPerLocatorUtilities().getInjectionResolver(locator, injectee); args[injectee.getPosition()] = resolver.resolve(injectee, null); } try { return (T) ReflectionHelper.makeMe(c, args, locator.getNeutralContextClassLoader()); } catch (Throwable th) { throw new MultiException(th); } }
/** * Just creates the thing, doesn't try to do anything else * @param createMe The thing to create * @param locator The locator to find the injection points with * @param strategy The strategy to use for analyzing the class * @return The constructed thing, no further injection is performed */ @SuppressWarnings("unchecked") public static <T> T justCreate(Class<T> createMe, ServiceLocatorImpl locator, String strategy) { if (createMe == null) throw new IllegalArgumentException(); Collector collector = new Collector(); ClassAnalyzer analyzer = getClassAnalyzer(locator, strategy, collector); collector.throwIfErrors(); Constructor<?> c = getConstructor(createMe, analyzer, collector); collector.throwIfErrors(); List<SystemInjecteeImpl> injectees = getConstructorInjectees(c, null); validateSelfInjectees(null, injectees, collector); collector.throwIfErrors(); Object args[] = new Object[injectees.size()]; for (SystemInjecteeImpl injectee : injectees) { InjectionResolver<?> resolver = locator.getPerLocatorUtilities().getInjectionResolver(locator, injectee); args[injectee.getPosition()] = resolver.resolve(injectee, null); } try { return (T) ReflectionHelper.makeMe(c, args, locator.getNeutralContextClassLoader()); } catch (Throwable th) { throw new MultiException(th); } }
/** * Just creates the thing, doesn't try to do anything else * @param createMe The thing to create * @param locator The locator to find the injection points with * @param strategy The strategy to use for analyzing the class * @return The constructed thing, no further injection is performed */ @SuppressWarnings("unchecked") public static <T> T justCreate(Class<T> createMe, ServiceLocatorImpl locator, String strategy) { if (createMe == null) throw new IllegalArgumentException(); Collector collector = new Collector(); ClassAnalyzer analyzer = getClassAnalyzer(locator, strategy, collector); collector.throwIfErrors(); Constructor<?> c = getConstructor(createMe, analyzer, collector); collector.throwIfErrors(); List<SystemInjecteeImpl> injectees = getConstructorInjectees(c, null); validateSelfInjectees(null, injectees, collector); collector.throwIfErrors(); Object args[] = new Object[injectees.size()]; for (SystemInjecteeImpl injectee : injectees) { InjectionResolver<?> resolver = locator.getPerLocatorUtilities().getInjectionResolver(locator, injectee); args[injectee.getPosition()] = resolver.resolve(injectee, null); } try { return (T) ReflectionHelper.makeMe(c, args, locator.getNeutralContextClassLoader()); } catch (Throwable th) { throw new MultiException(th); } }
/** * Just creates the thing, doesn't try to do anything else * @param createMe The thing to create * @param locator The locator to find the injection points with * @param strategy The strategy to use for analyzing the class * @return The constructed thing, no further injection is performed */ @SuppressWarnings("unchecked") public static <T> T justCreate(Class<T> createMe, ServiceLocatorImpl locator, String strategy) { if (createMe == null) throw new IllegalArgumentException(); Collector collector = new Collector(); ClassAnalyzer analyzer = getClassAnalyzer(locator, strategy, collector); collector.throwIfErrors(); Constructor<?> c = getConstructor(createMe, analyzer, collector); collector.throwIfErrors(); List<SystemInjecteeImpl> injectees = getConstructorInjectees(c, null); validateSelfInjectees(null, injectees, collector); collector.throwIfErrors(); Object args[] = new Object[injectees.size()]; for (SystemInjecteeImpl injectee : injectees) { InjectionResolver<?> resolver = locator.getPerLocatorUtilities().getInjectionResolver(locator, injectee); args[injectee.getPosition()] = resolver.resolve(injectee, null); } try { return (T) ReflectionHelper.makeMe(c, args, locator.getNeutralContextClassLoader()); } catch (Throwable th) { throw new MultiException(th); } }