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.visitors.VerifyingVisitor}, that will throw this exception.
023 */
024 public class PicoVerificationException
025 extends PicoException {
026 /**
027 * The exceptions that caused this one.
028 */
029 private final List nestedExceptions = new ArrayList();
030
031 /**
032 * Construct a new exception with a list of exceptions that caused this one.
033 *
034 * @param nestedExceptions the exceptions that caused this one.
035 */
036 public PicoVerificationException(final List nestedExceptions) {
037 this.nestedExceptions.addAll(nestedExceptions);
038 }
039
040 /**
041 * Retrieve the list of exceptions that caused this one.
042 *
043 * @return the list of exceptions that caused this one.
044 */
045 public List getNestedExceptions() {
046 return nestedExceptions;
047 }
048
049 /**
050 * Return a string listing of all the messages associated with the exceptions that caused
051 * this one.
052 *
053 * @return a string listing of all the messages associated with the exceptions that caused
054 * this one.
055 */
056 public String getMessage() {
057 return nestedExceptions.toString();
058 }
059 }