View Javadoc
1 /****************************************************************************** 2 * Copyright (C) PicoContainer Organization. All rights reserved. * 3 * ------------------------------------------------------------------------- * 4 * The software in this package is published under the terms of the BSD * 5 * style license a copy of which has been included with this distribution in * 6 * the LICENSE.txt file. * 7 * * 8 * Idea by Rachel Davies, Original code by Aslak Hellesoy and Paul Hammant * 9 *****************************************************************************/ 10 package org.picocontainer.defaults; 11 12 import org.picocontainer.PicoInstantiationException; 13 14 import java.util.Arrays; 15 16 public class AmbiguousComponentResolutionException extends PicoInstantiationException { 17 private Class ambiguousClass; 18 private final Object[] foundKeys; 19 20 public AmbiguousComponentResolutionException(Class ambiguousClass, Object[] foundKeys) { 21 this.ambiguousClass = ambiguousClass; 22 this.foundKeys = foundKeys; 23 } 24 25 public String getMessage() { 26 StringBuffer msg = new StringBuffer(); 27 msg.append("Ambigious class "); 28 msg.append(ambiguousClass); 29 msg.append(", "); 30 msg.append("resolves to multiple keys "); 31 msg.append(Arrays.asList(foundKeys)); 32 return msg.toString(); 33 } 34 35 public Object[] getResultingKeys() { 36 return foundKeys; 37 } 38 }

This page was automatically generated by Maven