MCPcopy Create free account
hub / github.com/google/guice / forMember

Method forMember

core/src/com/google/inject/spi/InjectionPoint.java:131–161  ·  view source on GitHub ↗
(
      Errors errors,
      Member member,
      TypeLiteral<?> type,
      AnnotatedType[] annotatedTypes,
      Annotation[][] parameterAnnotationsPerParameter,
      Predicate<Integer> isParameterKotlinNullable)

Source from the content-addressed store, hash-verified

129 }
130
131 private ImmutableList<Dependency<?>> forMember(
132 Errors errors,
133 Member member,
134 TypeLiteral<?> type,
135 AnnotatedType[] annotatedTypes,
136 Annotation[][] parameterAnnotationsPerParameter,
137 Predicate<Integer> isParameterKotlinNullable) {
138 List<Dependency<?>> dependencies = Lists.newArrayList();
139 int index = 0;
140
141 for (TypeLiteral<?> parameterType : type.getParameterTypes(member)) {
142 try {
143 Annotation[] typeAnnotations = annotatedTypes[index].getAnnotations();
144 Annotation[] parameterAnnotations = parameterAnnotationsPerParameter[index];
145 Key<?> key = Annotations.getKey(parameterType, member, parameterAnnotations, errors);
146 boolean isNullable =
147 Nullability.hasNullableAnnotation(parameterAnnotations)
148 || Nullability.hasNullableAnnotation(typeAnnotations)
149 || isParameterKotlinNullable.test(index);
150 dependencies.add(newDependency(key, isNullable, index));
151 index++;
152 } catch (ConfigurationException e) {
153 errors.merge(e.getErrorMessages());
154 } catch (ErrorsException e) {
155 errors.merge(e.getErrors());
156 }
157 }
158
159 errors.throwConfigurationExceptionIfErrorsExist();
160 return ImmutableList.copyOf(dependencies);
161 }
162
163 // This metohd is necessary to create a Dependency<T> with proper generic type information
164 private <T> Dependency<T> newDependency(Key<T> key, boolean allowsNull, int parameterIndex) {

Callers 1

InjectionPointMethod · 0.95

Calls 11

getKeyMethod · 0.95
hasNullableAnnotationMethod · 0.95
newDependencyMethod · 0.95
getParameterTypesMethod · 0.80
mergeMethod · 0.80
getAnnotationsMethod · 0.65
testMethod · 0.45
addMethod · 0.45
getErrorMessagesMethod · 0.45
getErrorsMethod · 0.45

Tested by

no test coverage detected