/** * Returns the dependencies from the given injection points. */ public static Set<Dependency<?>> forInjectionPoints(Set<InjectionPoint> injectionPoints) { Set<Dependency<?>> dependencies = new HashSet<>(); for (InjectionPoint injectionPoint : injectionPoints) { dependencies.addAll(injectionPoint.getDependencies()); } return unmodifiableSet(dependencies); }
SingleFieldInjector(InjectorImpl injector, InjectionPoint injectionPoint, Errors errors) throws ErrorsException { this.injectionPoint = injectionPoint; this.field = (Field) injectionPoint.getMember(); this.dependency = injectionPoint.getDependencies().get(0); factory = injector.getInternalFactory(dependency.getKey(), errors); }
SingleMethodInjector(InjectorImpl injector, InjectionPoint injectionPoint, Errors errors) throws ErrorsException { this.injectionPoint = injectionPoint; final Method method = (Method) injectionPoint.getMember(); methodInvoker = createMethodInvoker(method); parameterInjectors = injector.getParametersInjectors(injectionPoint.getDependencies(), errors); }
public static void formatInjectionPoint(Formatter formatter, Dependency<?> dependency, InjectionPoint injectionPoint) { Member member = injectionPoint.getMember(); Class<? extends Member> memberType = MoreTypes.memberType(member); if (memberType == Field.class) { dependency = injectionPoint.getDependencies().get(0); formatter.format(" while locating %s%n", convert(dependency.getKey())); formatter.format(" for field at %s%n", StackTraceElements.forMember(member)); } else if (dependency != null) { formatter.format(" while locating %s%n", convert(dependency.getKey())); formatter.format(" for parameter %s at %s%n", dependency.getParameterIndex(), StackTraceElements.forMember(member)); } else { formatSource(formatter, injectionPoint.getMember()); } } }
private <T> ConstructorInjector<T> createConstructor(TypeLiteral<T> type, Errors errors) throws ErrorsException { int numErrorsBefore = errors.size(); InjectionPoint injectionPoint; try { injectionPoint = InjectionPoint.forConstructorOf(type); } catch (ConfigurationException e) { errors.merge(e.getErrorMessages()); throw errors.toException(); } SingleParameterInjector<?>[] constructorParameterInjectors = injector.getParametersInjectors(injectionPoint.getDependencies(), errors); MembersInjectorImpl<T> membersInjector = injector.membersInjectorStore.get(type, errors); ConstructionProxyFactory<T> factory = new DefaultConstructionProxyFactory<>(injectionPoint); errors.throwIfNewErrors(numErrorsBefore); return new ConstructorInjector<>(membersInjector.getInjectionPoints(), factory.create(), constructorParameterInjectors, membersInjector); } }
/** * Returns the dependencies from the given injection points. */ public static Set<Dependency<?>> forInjectionPoints(Set<InjectionPoint> injectionPoints) { Set<Dependency<?>> dependencies = new HashSet<>(); for (InjectionPoint injectionPoint : injectionPoints) { dependencies.addAll(injectionPoint.getDependencies()); } return unmodifiableSet(dependencies); }
/** * Returns the dependencies from the given injection points. */ public static Set<Dependency<?>> forInjectionPoints(Set<InjectionPoint> injectionPoints) { Set<Dependency<?>> dependencies = new HashSet<>(); for (InjectionPoint injectionPoint : injectionPoints) { dependencies.addAll(injectionPoint.getDependencies()); } return unmodifiableSet(dependencies); }
/** * Returns the dependencies from the given injection points. */ public static Set<Dependency<?>> forInjectionPoints(Set<InjectionPoint> injectionPoints) { Set<Dependency<?>> dependencies = new HashSet<>(); for (InjectionPoint injectionPoint : injectionPoints) { dependencies.addAll(injectionPoint.getDependencies()); } return unmodifiableSet(dependencies); }
/** * Returns the dependencies from the given injection points. */ public static Set<Dependency<?>> forInjectionPoints(Set<InjectionPoint> injectionPoints) { List<Dependency<?>> dependencies = new ArrayList<>(); for (InjectionPoint injectionPoint : injectionPoints) { dependencies.addAll(injectionPoint.getDependencies()); } return ImmutableSet.copyOf(dependencies); }
SingleFieldInjector(InjectorImpl injector, InjectionPoint injectionPoint, Errors errors) throws ErrorsException { this.injectionPoint = injectionPoint; this.field = (Field) injectionPoint.getMember(); this.dependency = injectionPoint.getDependencies().get(0); factory = injector.getInternalFactory(dependency.getKey(), errors); }
public SingleFieldInjector(InjectorImpl injector, InjectionPoint injectionPoint, Errors errors) throws ErrorsException { this.injectionPoint = injectionPoint; this.field = (Field) injectionPoint.getMember(); this.dependency = injectionPoint.getDependencies().get(0); factory = injector.getInternalFactory(dependency.getKey(), errors); }
SingleFieldInjector(InjectorImpl injector, InjectionPoint injectionPoint, Errors errors) throws ErrorsException { this.injectionPoint = injectionPoint; this.field = (Field) injectionPoint.getMember(); this.dependency = injectionPoint.getDependencies().get(0); factory = injector.getInternalFactory(dependency.getKey(), errors); }
SingleFieldInjector(InjectorImpl injector, InjectionPoint injectionPoint, Errors errors) throws ErrorsException { this.injectionPoint = injectionPoint; this.field = (Field) injectionPoint.getMember(); this.dependency = injectionPoint.getDependencies().get(0); factory = injector.getInternalFactory(dependency.getKey(), errors); }
public SingleMethodInjector(InjectorImpl injector, InjectionPoint injectionPoint, Errors errors) throws ErrorsException { this.injectionPoint = injectionPoint; final Method method = (Method) injectionPoint.getMember(); methodInvoker = createMethodInvoker(method); parameterInjectors = injector.getParametersInjectors(injectionPoint.getDependencies(), errors); }
SingleMethodInjector(InjectorImpl injector, InjectionPoint injectionPoint, Errors errors) throws ErrorsException { this.injectionPoint = injectionPoint; final Method method = (Method) injectionPoint.getMember(); methodInvoker = createMethodInvoker(method); parameterInjectors = injector.getParametersInjectors(injectionPoint.getDependencies(), errors); }
SingleMethodInjector(InjectorImpl injector, InjectionPoint injectionPoint, Errors errors) throws ErrorsException { this.injectionPoint = injectionPoint; final Method method = (Method) injectionPoint.getMember(); methodInvoker = createMethodInvoker(method); parameterInjectors = injector.getParametersInjectors(injectionPoint.getDependencies(), errors); }
SingleMethodInjector(InjectorImpl injector, InjectionPoint injectionPoint, Errors errors) throws ErrorsException { this.injectionPoint = injectionPoint; final Method method = (Method) injectionPoint.getMember(); methodInvoker = createMethodInvoker(method); parameterInjectors = injector.getParametersInjectors(injectionPoint.getDependencies(), errors); }
public static void formatInjectionPoint(Formatter formatter, Dependency<?> dependency, InjectionPoint injectionPoint) { Member member = injectionPoint.getMember(); Class<? extends Member> memberType = MoreTypes.memberType(member); if (memberType == Field.class) { dependency = injectionPoint.getDependencies().get(0); formatter.format(" while locating %s%n", convert(dependency.getKey())); formatter.format(" for field at %s%n", StackTraceElements.forMember(member)); } else if (dependency != null) { formatter.format(" while locating %s%n", convert(dependency.getKey())); formatter.format(" for parameter %s at %s%n", dependency.getParameterIndex(), StackTraceElements.forMember(member)); } else { formatSource(formatter, injectionPoint.getMember()); } } }
public static void formatInjectionPoint(Formatter formatter, Dependency<?> dependency, InjectionPoint injectionPoint) { Member member = injectionPoint.getMember(); Class<? extends Member> memberType = MoreTypes.memberType(member); if (memberType == Field.class) { dependency = injectionPoint.getDependencies().get(0); formatter.format(" while locating %s%n", convert(dependency.getKey())); formatter.format(" for field at %s%n", StackTraceElements.forMember(member)); } else if (dependency != null) { formatter.format(" while locating %s%n", convert(dependency.getKey())); formatter.format(" for parameter %s at %s%n", dependency.getParameterIndex(), StackTraceElements.forMember(member)); } else { formatSource(formatter, injectionPoint.getMember()); } } }
public static void formatInjectionPoint(Formatter formatter, Dependency<?> dependency, InjectionPoint injectionPoint) { Member member = injectionPoint.getMember(); Class<? extends Member> memberType = MoreTypes.memberType(member); if (memberType == Field.class) { dependency = injectionPoint.getDependencies().get(0); formatter.format(" while locating %s%n", convert(dependency.getKey())); formatter.format(" for field at %s%n", StackTraceElements.forMember(member)); } else if (dependency != null) { formatter.format(" while locating %s%n", convert(dependency.getKey())); formatter.format(" for parameter %s at %s%n", dependency.getParameterIndex(), StackTraceElements.forMember(member)); } else { formatSource(formatter, injectionPoint.getMember()); } } }