@Override protected Map<Object, ComponentAdapter<?>> getMatchingComponentAdapters(final PicoContainer container, final ComponentAdapter adapter, final Class keyType, final Generic<?> valueType) { final Map<Object, ComponentAdapter<?>> map = super.getMatchingComponentAdapters(container, adapter, keyType, valueType); if (map.size() > 1) { throw new AbstractInjector.AmbiguousComponentResolutionException(valueType, map.keySet().toArray(new Object[map.size()])); } return map; }
private <T> AbstractInjector.AmbiguousComponentResolutionException tooManyMatchingAdaptersFound(final Generic<T> expectedType, final List<ComponentAdapter<T>> found) { Class[] foundClasses = new Class[found.size()]; for (int i = 0; i < foundClasses.length; i++) { foundClasses[i] = found.get(i).getComponentImplementation(); } AbstractInjector.AmbiguousComponentResolutionException exception = new AbstractInjector.AmbiguousComponentResolutionException(expectedType, foundClasses); return exception; }
private <T> AbstractInjector.AmbiguousComponentResolutionException tooManyMatchingAdaptersFound(final Generic<T> expectedType, final List<ComponentAdapter<T>> found) { Class[] foundClasses = new Class[found.size()]; for (int i = 0; i < foundClasses.length; i++) { foundClasses[i] = found.get(i).getComponentImplementation(); } AbstractInjector.AmbiguousComponentResolutionException exception = new AbstractInjector.AmbiguousComponentResolutionException(expectedType, foundClasses); return exception; }
throw new AbstractInjector.AmbiguousComponentResolutionException(componentType, foundClasses);
throw new AbstractInjector.AmbiguousComponentResolutionException(componentType, foundClasses);