View Javadoc

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.PropertyValueConversionException;
20  import de.smartics.properties.api.core.domain.PropertyValueMessageBean;
21  
22  /**
23   * Provides information about property conversion problems including the source
24   * location.
25   */
26  public class PropertyValueWithSourceMessageBean extends
27      PropertyValueMessageBean
28  {
29    // ********************************* Fields *********************************
30  
31    // --- constants ------------------------------------------------------------
32  
33    /**
34     * The class version identifier.
35     * <p>
36     * The value of this constant is {@value}.
37     * </p>
38     */
39    private static final long serialVersionUID = 1L;
40  
41    // --- members --------------------------------------------------------------
42  
43    /**
44     * The source where the property value has been defined.
45     *
46     * @serial
47     */
48    @MessageParam
49    private final PropertyLocation source; // NOPMD
50  
51    // ****************************** Initializer *******************************
52  
53    // ****************************** Constructors ******************************
54  
55    /**
56     * Default constructor.
57     *
58     * @param original the original property validation exception without the
59     *          origin information.
60     * @param source the source where the property value has been defined.
61     */
62    public PropertyValueWithSourceMessageBean(
63        final PropertyValueConversionException original,
64        final PropertyLocation source)
65    {
66      super(
67          ConfigurationCode.INVALID_CONFIGURATION_DUE_TO_CONVERSION_WITH_SOURCE,
68          original.getCause(), original.getMessageBean().getPropertyDescriptor(),
69          original.getMessageBean().getValue());
70      this.source = source;
71    }
72  
73    // ****************************** Inner Classes *****************************
74  
75    // ********************************* Methods ********************************
76  
77    // --- init -----------------------------------------------------------------
78  
79    // --- get&set --------------------------------------------------------------
80  
81    // --- business -------------------------------------------------------------
82  
83    // --- object basics --------------------------------------------------------
84  
85  }