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