01: /*****************************************************************************
02: * Copyright (C) PicoContainer Organization. All rights reserved. *
03: * ------------------------------------------------------------------------- *
04: * The software in this package is published under the terms of the BSD *
05: * style license a copy of which has been included with this distribution in *
06: * the LICENSE.txt file. *
07: * *
08: * Original code by *
09: *****************************************************************************/package org.picocontainer;
10:
11: import java.util.ArrayList;
12: import java.util.List;
13:
14: /**
15: * Subclass of {@link PicoException} that is thrown when a {@link PicoContainer} hierarchy
16: * cannot be verified. A failing verification is caused by ambuigities or missing dependencies
17: * between the registered components and their parameters. This exception is designed as a
18: * collector for all Exceptions occurring at the verification of the complete container
19: * hierarchy. The verification is normally done with the
20: * {@link org.picocontainer.visitors.VerifyingVisitor}, that will throw this exception.
21: */
22: public class PicoVerificationException extends PicoException {
23: /**
24: * Serialization UUID.
25: */
26: private static final long serialVersionUID = -9008292036585394986L;
27:
28: /**
29: * The exceptions that caused this one.
30: */
31: private final List<Throwable> nestedExceptions = new ArrayList<Throwable>();
32:
33: /**
34: * Construct a new exception with a list of exceptions that caused this one.
35: *
36: * @param nestedExceptions the exceptions that caused this one.
37: */
38: public PicoVerificationException(
39: final List<? extends Throwable> nestedExceptions) {
40: this .nestedExceptions.addAll(nestedExceptions);
41: }
42:
43: /**
44: * Retrieve the list of exceptions that caused this one.
45: *
46: * @return the list of exceptions that caused this one.
47: */
48: public List<Throwable> getNestedExceptions() {
49: return nestedExceptions;
50: }
51:
52: /**
53: * Return a string listing of all the messages associated with the exceptions that caused
54: * this one.
55: *
56: * @return a string listing of all the messages associated with the exceptions that caused
57: * this one.
58: */
59: public String getMessage() {
60: return nestedExceptions.toString();
61: }
62: }
|