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.core.domain.PropertyValidationException; 20 import de.smartics.properties.api.core.domain.PropertyValidationMessageBean; 21 22 /** 23 * Provides information about property violations including the source location. 24 */ 25 public class PropertyValidationWithSourceMessageBean extends 26 PropertyValidationMessageBean 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 source where the property value has been defined. 44 * 45 * @serial 46 */ 47 @MessageParam 48 private final PropertyLocation source; 49 50 // ****************************** Initializer ******************************* 51 52 // ****************************** Constructors ****************************** 53 54 /** 55 * Default constructor. 56 * 57 * @param original the original property validation exception without the 58 * origin information. 59 * @param source the source where the property value has been defined. 60 */ 61 public PropertyValidationWithSourceMessageBean( 62 final PropertyValidationException original, final PropertyLocation source) 63 { 64 super(ConfigurationCode.INVALID_CONFIGURATION_WITH_SOURCE, original, 65 original.getMessageBean().getPropertyDescriptor(), original 66 .getMessageBean().getConstraints(), original.getMessageBean() 67 .getValue()); 68 this.source = source; 69 } 70 71 // ****************************** Inner Classes ***************************** 72 73 // ********************************* Methods ******************************** 74 75 // --- init ----------------------------------------------------------------- 76 77 // --- get&set -------------------------------------------------------------- 78 79 /** 80 * Returns the source where the property value has been defined. 81 * 82 * @return the source where the property value has been defined. 83 */ 84 public final PropertyLocation getSource() 85 { 86 return source; 87 } 88 89 // --- business ------------------------------------------------------------- 90 91 // --- object basics -------------------------------------------------------- 92 93 }