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.core.domain; 17 18 import de.smartics.exceptions.i18n.message.MessageParam; 19 import de.smartics.properties.api.core.app.AbstractBaseMessageBean; 20 import de.smartics.properties.api.core.app.PropertiesCode; 21 22 /** 23 * Provides context information for errors concerning a property. 24 */ 25 public class PropertyMessageBean 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 of the property raising the exception. 40 * 41 * @serial 42 */ 43 @MessageParam 44 private final PropertyKey propertyKey; 45 46 // ****************************** Initializer ******************************* 47 48 // ****************************** Constructors ****************************** 49 50 /** 51 * Default constructor. 52 * 53 * @param code the error or exception code of the exception. 54 * @param cause the cause to the problem. 55 * @param propertyKey the key of the property raising the exception. 56 */ 57 public PropertyMessageBean(final PropertiesCode code, final Throwable cause, 58 final PropertyKey propertyKey) 59 { 60 super(code, cause); 61 this.propertyKey = propertyKey; 62 } 63 64 // ****************************** Inner Classes ***************************** 65 66 // ********************************* Methods ******************************** 67 68 // --- init ----------------------------------------------------------------- 69 70 // --- get&set -------------------------------------------------------------- 71 72 /** 73 * Returns the key of the property raising the exception. 74 * 75 * @return the key of the property raising the exception. 76 */ 77 public final PropertyKey getPropertyKey() 78 { 79 return propertyKey; 80 } 81 82 // --- business ------------------------------------------------------------- 83 84 // --- object basics -------------------------------------------------------- 85 86 }