@Override public Logger supply(Dependency<? super Logger> dependency, Injector injector) { if (dependency.isUntargeted()) { return LoggerFactory.getLogger("General"); } else { return LoggerFactory.getLogger(dependency.target().getType().getRawType()); } }
@Override public Provider<?> supply(Dependency<? super Provider<?>> dependency, Injector injector) { Dependency<?> providedType = dependency.onTypeParameter(); if (!dependency.getName().isDefault()) { providedType = providedType.named(dependency.getName()); } return newProvider(providedType, injector); }
@Override public T supply(Dependency<? super T> dependency, Injector injector) { Type<? super T> type = dependency.getType(); Instance<? extends T> parametrized = instance.typed( instance .getType() .parametized(type.getParameters()) .lowerBound(dependency.getType().isLowerBound())); return injector.resolve(dependency.instanced(parametrized)); }
@SuppressWarnings("unchecked") @Override public E[] supply(Dependency<? super E[]> dependency, Injector injector) { E[] res = (E[]) Array.newInstance(arrayType.getComponentType(), elements.length); int i = 0; final Dependency<E> elementDependency = (Dependency<E>) dependency.typed(Type.raw(arrayType).elementType()); for (Supplier<? extends E> e : elements) { res[i++] = e.supply(elementDependency, injector); } return res; }
@Override public T supply(Dependency<? super T> dependency, Injector injector) { return factory.produce(dependency.getInstance(), dependency.target(1)); }
@Override public T supply(Dependency<? super T> dependency, Injector injector) { return injector.resolve(dependency.instanced(instance)); }
@Override public T supply(Dependency<? super T> dependency, Injector injector) { final Supplier<? extends T> supplier = injector.resolve(dependency.anyTyped(type)); return supplier.supply(dependency, injector); }
@Override public final T supply(Dependency<? super T> dependency, Injector injector) { Type<?> elementType = dependency.getType().parameter(0); return bridge(supplyArray(dependency.anyTyped(elementType.getArrayType()), injector)); }