View Javadoc

1   /*
2    * Copyright 2010-2013 smartics, Kronseder & Reiner GmbH
3    *
4    * Licensed under the Apache License, Version 2.0 (the "License");
5    * you may not use this file except in compliance with the License.
6    * You may obtain a copy of the License at
7    *
8    *     http://www.apache.org/licenses/LICENSE-2.0
9    *
10   * Unless required by applicable law or agreed to in writing, software
11   * distributed under the License is distributed on an "AS IS" BASIS,
12   * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13   * See the License for the specific language governing permissions and
14   * limitations under the License.
15   */
16  package de.smartics.testdoc.report.resource;
17  
18  import de.smartics.testdoc.core.BlankArgumentException;
19  
20  /**
21   * Signals that a references icon has not been found at the specified location.
22   *
23   * @author <a href="mailto:robert.reiner@smartics.de">Robert Reiner</a>
24   * @version $Revision:591 $
25   */
26  public class IconNotFoundException extends RuntimeException
27  {
28    // ********************************* Fields *********************************
29  
30    // --- constants ------------------------------------------------------------
31  
32    /**
33     * The class version identifier.
34     */
35    private static final long serialVersionUID = 1L;
36  
37    // --- members --------------------------------------------------------------
38  
39    /**
40     * The identifier of the icon that has not been found.
41     *
42     * @serial
43     */
44    private final String iconId;
45  
46    // ****************************** Initializer *******************************
47  
48    // ****************************** Constructors ******************************
49  
50    /**
51     * Convenience constructor.
52     *
53     * @param iconId the identifier of the icon that has not been found.
54     * @see IconNotFoundException#ResourceNotFoundException(String, null)
55     */
56    public IconNotFoundException(final String iconId)
57    {
58      this(iconId, null);
59    }
60  
61    /**
62     * Default constructor.
63     *
64     * @param iconId the identifier of the icon that has not been found.
65     * @param cause the cause (which is saved for later retrieval by the
66     *          {@link #getCause()} method). (A <tt>null</tt> value is permitted,
67     *          and indicates that the cause is nonexistent or unknown.)
68     * @see RuntimeException#RuntimeException(String, Throwable)
69     */
70    public IconNotFoundException(final String iconId, final Throwable cause)
71    {
72      super(createMessage(iconId), cause);
73      this.iconId = iconId;
74    }
75  
76    // ****************************** Inner Classes *****************************
77  
78    // ********************************* Methods ********************************
79  
80    // --- init -----------------------------------------------------------------
81  
82    private static String createMessage(final String iconId)
83      throws BlankArgumentException
84    {
85      return "Referenced icon '" + iconId + "' cannot be found.";
86    }
87  
88    // --- get&set --------------------------------------------------------------
89  
90    /**
91     * Returns the identifier of the icon that has not been found.
92     *
93     * @return the identifier of the icon that has not been found.
94     */
95    public String getIconId()
96    {
97      return iconId;
98    }
99  
100   // --- business -------------------------------------------------------------
101 
102   // --- object basics --------------------------------------------------------
103 
104 }