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