001 /*****************************************************************************
002 * Copyright (C) PicoContainer Organization. All rights reserved. *
003 * ------------------------------------------------------------------------- *
004 * The software in this package is published under the terms of the BSD *
005 * style license a copy of which has been included with this distribution in *
006 * the LICENSE.txt file. *
007 * *
008 * Original code by *
009 *****************************************************************************/
010 package org.picocontainer;
011
012 import java.util.ArrayList;
013 import java.util.List;
014
015
016 /**
017 * Subclass of {@link PicoException} that is thrown when a {@link PicoContainer} hierarchy
018 * cannot be verified. A failing verification is caused by ambuigities or missing dependencies
019 * between the registered components and their parameters. This exception is designed as a
020 * collector for all Exceptions occuring at the verification of the complete container
021 * hierarchy. The verification is normally done with the
022 * {@link org.picocontainer.defaults.VerifyingVisitor}, that will throw this exception.
023 *
024 * @version $Revision: 1801 $
025 * @since 1.0
026 */
027 public class PicoVerificationException
028 extends PicoException {
029 /**
030 * The exceptions that caused this one.
031 */
032 private final List nestedExceptions = new ArrayList();
033
034 /**
035 * Construct a new exception with a list of exceptions that caused this one.
036 *
037 * @param nestedExceptions the exceptions that caused this one.
038 */
039 public PicoVerificationException(final List nestedExceptions) {
040 this.nestedExceptions.addAll(nestedExceptions);
041 }
042
043 /**
044 * Retrieve the list of exceptions that caused this one.
045 *
046 * @return the list of exceptions that caused this one.
047 */
048 public List getNestedExceptions() {
049 return nestedExceptions;
050 }
051
052 /**
053 * Return a string listing of all the messages associated with the exceptions that caused
054 * this one.
055 *
056 * @return a string listing of all the messages associated with the exceptions that caused
057 * this one.
058 */
059 public String getMessage() {
060 return nestedExceptions.toString();
061 }
062 }