/** * Add a dependency of this component. * @param dep The dependency. * @return The builder (for chaining). */ public ComponentNodeBuilder addDependency(Desire dep) { Annotation q = dep.getInjectionPoint().getQualifier(); Class<?> type = dep.getDesiredType(); if (q == null) { dependencies.add(shortClassName(type)); } else { dependencies.add(shortAnnotation(q) + ": " + shortClassName(type)); } return this; }
@Override public Type getType() { return Types.parameterizedType(Provider.class, providedDesire.getDesiredType()); }
@Override public boolean matches(Desire desire) { // bind rules match type by equality if (desire.getDesiredType().equals(depType)) { // if the type is equal, then rely on the qualifier matcher return qualifier.matches(desire.getInjectionPoint().getQualifier()); } // the type and {@link Qualifier}s are not a match, so return false return false; }
protected String format(InjectionContext ctx, DesireChain desires) { StringBuilder sb = new StringBuilder(); // type path sb.append("Context:\n"); sb.append(" Type path:\n"); for (Pair<Satisfaction, InjectionPoint> path: ctx) { Satisfaction sat = path.getLeft(); Class<?> type = sat == null ? null : sat.getErasedType(); sb.append(" ") .append(format(path.getRight(), type)) .append('\n'); } sb.append('\n'); // desire chain sb.append(" Prior desires:\n"); for (Desire desire: desires.getPreviousDesires()) { sb.append(" ") .append(format(desire.getInjectionPoint(), desire.getDesiredType())) .append('\n'); } return sb.toString(); }
/** * Add a dependency of this component. * @param dep The dependency. * @return The builder (for chaining). */ public ComponentNodeBuilder addDependency(Desire dep) { Annotation q = dep.getInjectionPoint().getQualifier(); Class<?> type = dep.getDesiredType(); if (q == null) { dependencies.add(shortClassName(type)); } else { dependencies.add(shortAnnotation(q) + ": " + shortClassName(type)); } return this; }
result = getAnnotatedDefault(desire, desire.getDesiredType()); result = getMetaInfDefault(desire, desire.getDesiredType());
@Override public BindingResult bind(InjectionContext context, DesireChain desires) throws ResolutionException { Desire desire = desires.getCurrentDesire(); if (Provider.class.equals(desire.getDesiredType())) {
if (dnull != null) { return BindingResult.newBuilder() .setDesire(desire.restrict(Satisfactions.nullOfType(desire.getDesiredType()))) .setCachePolicy(CachePolicy.NO_PREFERENCE) .addFlag(BindingFlag.TERMINAL)