/** * Returns a new injection point for the injectable constructor of {@code type}. * * @param type a concrete type with exactly one constructor annotated {@literal @}{@link Inject}, * or a no-arguments constructor that is not private. * @throws ConfigurationException if there is no injectable constructor, more than one injectable * constructor, or if parameters of the injectable constructor are malformed, such as a * parameter with multiple binding annotations. */ public static InjectionPoint forConstructorOf(Class<?> type) { return forConstructorOf(TypeLiteral.get(type)); }
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 a new injection point for the injectable constructor of {@code type}. * * @param type a concrete type with exactly one constructor annotated {@literal @}{@link Inject}, * or a no-arguments constructor that is not private. * @throws ConfigurationException if there is no injectable constructor, more than one injectable * constructor, or if parameters of the injectable constructor are malformed, such as a * parameter with multiple binding annotations. */ public static InjectionPoint forConstructorOf(Class<?> type) { return forConstructorOf(TypeLiteral.get(type)); }
/** * Returns a new injection point for the injectable constructor of {@code type}. * * @param type a concrete type with exactly one constructor annotated {@literal @}{@link Inject}, * or a no-arguments constructor that is not private. * @throws ConfigurationException if there is no injectable constructor, more than one injectable * constructor, or if parameters of the injectable constructor are malformed, such as a * parameter with multiple binding annotations. */ public static InjectionPoint forConstructorOf(Class<?> type) { return forConstructorOf(TypeLiteral.get(type)); }
/** * Returns a new injection point for the injectable constructor of {@code type}. * * @param type a concrete type with exactly one constructor annotated {@literal @}{@link Inject}, * or a no-arguments constructor that is not private. * @throws ConfigurationException if there is no injectable constructor, more than one injectable * constructor, or if parameters of the injectable constructor are malformed, such as a * parameter with multiple binding annotations. */ public static InjectionPoint forConstructorOf(Class<?> type) { return forConstructorOf(TypeLiteral.get(type)); }
/** * Returns a new injection point for the injectable constructor of {@code type}. * * @param type a concrete type with exactly one constructor annotated {@literal @}{@link Inject}, * or a no-arguments constructor that is not private. * @throws ConfigurationException if there is no injectable constructor, more than one injectable * constructor, or if parameters of the injectable constructor are malformed, such as a * parameter with multiple binding annotations. */ public static InjectionPoint forConstructorOf(Class<?> type) { return forConstructorOf(TypeLiteral.get(type)); }
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); } }
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); } }
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); } }
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); } }