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.core.domain;
17  
18  import de.smartics.exceptions.i18n.message.MessageParam;
19  
20  /**
21   * Provides context information for errors concerning two clashing property
22   * descriptors.
23   */
24  public class PropertyDescriptorClashingMessageBean extends
25      PropertyDescriptorMessageBean
26  {
27    // ********************************* Fields *********************************
28  
29    // --- constants ------------------------------------------------------------
30  
31    /**
32     * The class version identifier.
33     * <p>
34     * The value of this constant is {@value}.
35     * </p>
36     */
37    private static final long serialVersionUID = 1L;
38  
39    // --- members --------------------------------------------------------------
40  
41    /**
42     * The clashing property descriptor with the same key.
43     *
44     * @serial
45     */
46    @MessageParam("clashingDescriptorDeclaringType:declaringType")
47    private final PropertyDescriptor clashingDescriptor;
48  
49    // ****************************** Initializer *******************************
50  
51    // ****************************** Constructors ******************************
52  
53    /**
54     * Convenience constructor with no root cause.
55     *
56     * @param code the error or exception code of the exception.
57     * @param propertyDescriptor the descriptor of the property raising the
58     *          exception.
59     * @param clashingDescriptor the clashing property descriptor with the same
60     *          key.
61     */
62    public PropertyDescriptorClashingMessageBean(final PropertyCode code,
63        final PropertyDescriptor propertyDescriptor,
64        final PropertyDescriptor clashingDescriptor)
65    {
66      this(code, null, propertyDescriptor, clashingDescriptor);
67    }
68  
69    /**
70     * Default constructor.
71     *
72     * @param code the error or exception code of the exception.
73     * @param cause the cause (which is saved for later retrieval by the
74     *          {@link #getCause()} method). (A <tt>null</tt> value is permitted,
75     *          and indicates that the cause is nonexistent or unknown.)
76     * @param propertyDescriptor the descriptor of the property raising the
77     *          exception.
78     * @param clashingDescriptor the clashing property descriptor with the same
79     *          key.
80     */
81    public PropertyDescriptorClashingMessageBean(final PropertyCode code,
82        final Throwable cause, final PropertyDescriptor propertyDescriptor,
83        final PropertyDescriptor clashingDescriptor)
84    {
85      super(code, cause, propertyDescriptor);
86  
87      this.clashingDescriptor = clashingDescriptor;
88    }
89  
90    // ****************************** Inner Classes *****************************
91  
92    // ********************************* Methods ********************************
93  
94    // --- init -----------------------------------------------------------------
95  
96    // --- get&set --------------------------------------------------------------
97  
98    /**
99     * Returns the clashing property descriptor with the same key.
100    *
101    * @return the clashing property descriptor with the same key.
102    */
103   public final PropertyDescriptor getClashingDescriptor()
104   {
105     return clashingDescriptor;
106   }
107 
108   // --- business -------------------------------------------------------------
109 
110   // --- object basics --------------------------------------------------------
111 
112 }