/** * If there is no Parameter defined for the constructor arg, (Other than * Default), then checks to see if there are * {@linkplain javax.inject.Named} annotations or Qualifier annotations * attached to the argument and uses those as ComponentParameters * instead. If not it uses the superclass default behavior. */ @Override protected Parameter getParameterToUse(final Constructor<?> constructorToExamine, final int constructorParameterIndex, final Parameter parameter) { if (isDefaultParameter(parameter)) { // Search for Named class for (Annotation eachAnnotation : constructorToExamine.getParameterAnnotations()[constructorParameterIndex]) { if (eachAnnotation.annotationType().equals(Named.class)) { return new ComponentParameter(((Named) eachAnnotation).value()); } } // Search for a qualifier that isn't @Named annotation. Annotation qualifier = JSR330PicoContainer .getQualifier(constructorToExamine.getParameterAnnotations()[constructorParameterIndex]); if (qualifier != null) { return new ComponentParameter(qualifier.annotationType().getName()); } } return super.getParameterToUse(constructorToExamine, constructorParameterIndex, parameter); }
/** * If there is no Parameter defined for the constructor arg, (Other than * Default), then checks to see if there are * {@linkplain javax.inject.Named} annotations or Qualifier annotations * attached to the argument and uses those as ComponentParameters * instead. If not it uses the superclass default behavior. */ @Override protected Parameter getParameterToUse(final Constructor<?> constructorToExamine, final int constructorParameterIndex, final Parameter parameter) { if (isDefaultParameter(parameter)) { // Search for Named class for (Annotation eachAnnotation : constructorToExamine.getParameterAnnotations()[constructorParameterIndex]) { if (eachAnnotation.annotationType().equals(Named.class)) { return new ComponentParameter(((Named) eachAnnotation).value()); } } // Search for a qualifier that isn't @Named annotation. Annotation qualifier = JSR330PicoContainer .getQualifier(constructorToExamine.getParameterAnnotations()[constructorParameterIndex]); if (qualifier != null) { return new ComponentParameter(qualifier.annotationType().getName()); } } return super.getParameterToUse(constructorToExamine, constructorParameterIndex, parameter); }
Parameter parameterToUse = getParameterToUse(sortedMatchingConstructor,j, currentParameters[j]); parametersUsed.set(j, parameterToUse); ResolverKey resolverKey = new ResolverKey(expectedType, useNames() ? expectedNameBinding.getName() : null, useNames(), bindings[j], parameterToUse);
Parameter parameterToUse = getParameterToUse(sortedMatchingConstructor,j, currentParameters[j]); parametersUsed.set(j, parameterToUse); ResolverKey resolverKey = new ResolverKey(expectedType, useNames() ? expectedNameBinding.getName() : null, useNames(), bindings[j], parameterToUse);