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.codes.ConfigurationsCode; 19 import de.smartics.properties.api.config.domain.key.ConfigurationKey; 20 import de.smartics.properties.api.core.app.AbstractBaseMessageBean; 21 22 /** 23 * Provides context information for transfer problems. 24 */ 25 public class ConfigurationMessageBean extends AbstractBaseMessageBean 26 { 27 // ********************************* Fields ********************************* 28 29 // --- constants ------------------------------------------------------------ 30 31 /** 32 * The class version identifier. 33 */ 34 private static final long serialVersionUID = 1L; 35 36 // --- members -------------------------------------------------------------- 37 38 /** 39 * The key to the configuration that signaled problems. 40 * 41 * @serial 42 */ 43 private final ConfigurationKey<?> key; 44 45 // ****************************** Initializer ******************************* 46 47 // ****************************** Constructors ****************************** 48 49 /** 50 * Constructor without cause. 51 * 52 * @param code the error or exception code of the exception. 53 * @param key the key to the configuration that signaled problems. 54 */ 55 public ConfigurationMessageBean(final ConfigurationsCode code, 56 final ConfigurationKey<?> key) 57 { 58 this(code, null, key); 59 } 60 61 /** 62 * Default constructor. 63 * 64 * @param code the error or exception code of the exception. 65 * @param cause the cause to the problem. 66 * @param key the key to the configuration that signaled problems. 67 */ 68 public ConfigurationMessageBean(final ConfigurationsCode code, 69 final Throwable cause, final ConfigurationKey<?> key) 70 { 71 super(code, cause); 72 this.key = key; 73 } 74 75 // ****************************** Inner Classes ***************************** 76 77 // ********************************* Methods ******************************** 78 79 // --- init ----------------------------------------------------------------- 80 81 // --- factory -------------------------------------------------------------- 82 83 // --- get&set -------------------------------------------------------------- 84 85 /** 86 * Returns the key to the configuration that signaled problems. 87 * 88 * @return the key to the configuration that signaled problems. 89 */ 90 public final ConfigurationKey<?> getKey() 91 { 92 return key; 93 } 94 95 // --- business ------------------------------------------------------------- 96 97 // --- object basics -------------------------------------------------------- 98 99 }