View Javadoc

1   /*
2    * Copyright 2012-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.properties.api.config.domain;
17  
18  import de.smartics.exceptions.i18n.message.MessageParam;
19  import de.smartics.properties.api.config.domain.key.ConfigurationKey;
20  
21  /**
22   * Signals that a property is unknown.
23   */
24  public class UnknownPropertyException extends ConfigurationException
25  {
26    // ********************************* Fields *********************************
27  
28    // --- constants ------------------------------------------------------------
29  
30    /**
31     * The class version identifier.
32     * <p>
33     * The value of this constant is {@value}.
34     * </p>
35     */
36    private static final long serialVersionUID = 1L;
37  
38    // --- members --------------------------------------------------------------
39  
40    /**
41     * The key to the unknown property.
42     *
43     * @serial
44     */
45    @MessageParam
46    private final String propertyKey;
47  
48    // ****************************** Initializer *******************************
49  
50    // ****************************** Constructors ******************************
51  
52    /**
53     * Convenience constructor without root cause.
54     *
55     * @param key the key to the configuration that signaled problems.
56     * @param propertyKey the key to the unknown property.
57     */
58    public UnknownPropertyException(final ConfigurationKey<?> key,
59        final String propertyKey)
60    {
61      this(null, key, propertyKey);
62    }
63  
64    /**
65     * Default Constructor.
66     *
67     * @param cause the cause (which is saved for later retrieval by the
68     *          {@link #getCause()} method). (A <tt>null</tt> value is permitted,
69     *          and indicates that the cause is nonexistent or unknown.)
70     * @param key the key to the configuration that signaled problems.
71     * @param propertyKey the key to the unknown property.
72     */
73    public UnknownPropertyException(final Throwable cause,
74        final ConfigurationKey<?> key, final String propertyKey)
75    {
76      super(ConfigurationCode.UNKNOWN_PROPERTY, cause, key);
77      this.propertyKey = propertyKey;
78    }
79  
80    // ****************************** Inner Classes *****************************
81  
82    // ********************************* Methods ********************************
83  
84    // --- init -----------------------------------------------------------------
85  
86    // --- get&set --------------------------------------------------------------
87  
88    /**
89     * Returns the key to the unknown property.
90     *
91     * @return the key to the unknown property.
92     */
93    public final String getPropertyKey()
94    {
95      return propertyKey;
96    }
97  
98    // --- business -------------------------------------------------------------
99  
100   // --- object basics --------------------------------------------------------
101 
102 }