View Javadoc
1   package org.apache.maven.exception;
2   
3   /*
4    * Licensed to the Apache Software Foundation (ASF) under one
5    * or more contributor license agreements.  See the NOTICE file
6    * distributed with this work for additional information
7    * regarding copyright ownership.  The ASF licenses this file
8    * to you under the Apache License, Version 2.0 (the
9    * "License"); you may not use this file except in compliance
10   * with the License.  You may obtain a copy of the License at
11   *
12   *  http://www.apache.org/licenses/LICENSE-2.0
13   *
14   * Unless required by applicable law or agreed to in writing,
15   * software distributed under the License is distributed on an
16   * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
17   * KIND, either express or implied.  See the License for the
18   * specific language governing permissions and limitations
19   * under the License.
20   */
21  
22  import java.util.Collections;
23  import java.util.List;
24  
25  /**
26   * Provide a summary of the exception, containing:<ul>
27   * <li>the exception itself,</li>
28   * <li>useful end-user message,</li>
29   * <li>useful reference to a solution, or set of solutions: this is usually a wiki page url in
30   * <a href="http://cwiki.apache.org/confluence/display/MAVEN/">http://cwiki.apache.org/confluence/display/MAVEN/</a>,
31   * </li>
32   * <li>child exception summaries.</li>
33   * </ul>
34   */
35  public class ExceptionSummary
36  {
37  
38      private Throwable exception;
39  
40      private String message;
41  
42      private String reference;
43  
44      private List<ExceptionSummary> children;
45  
46      public ExceptionSummary( Throwable exception, String message, String reference )
47      {
48          this( exception, message, reference, null );
49      }
50  
51      public ExceptionSummary( Throwable exception, String message, String reference, List<ExceptionSummary> children )
52      {
53          this.exception = exception;
54          this.message = ( message != null ) ? message : "";
55          this.reference = ( reference != null ) ? reference : "";
56          this.children = ( children != null )
57                              ? Collections.unmodifiableList( children )
58                              : Collections.<ExceptionSummary>emptyList();
59  
60      }
61  
62      public Throwable getException()
63      {
64          return exception;
65      }
66  
67      public String getMessage()
68      {
69          return message;
70      }
71  
72      public String getReference()
73      {
74          return reference;
75      }
76  
77      public List<ExceptionSummary> getChildren()
78      {
79          return children;
80      }
81  
82  }