예제 #1
0
 @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;
 }
예제 #2
0
 @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);
 }