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 java.io.Serializable;
19  
20  /**
21   * Wrapper for duplicate key information.
22   */
23  final class DuplicateKeys implements Serializable
24  {
25    // ********************************* Fields *********************************
26  
27    // --- constants ------------------------------------------------------------
28  
29    /**
30     * The class version identifier.
31     */
32    private static final long serialVersionUID = 1L;
33  
34    // --- members --------------------------------------------------------------
35  
36    /**
37     * The key that has already been recognized as default.
38     *
39     * @serial
40     */
41    private final String currentDefaultKey; // NOPMD
42  
43    /**
44     * The second key that has been recognized as default. Only one default key is
45     * allowed.
46     *
47     * @serial
48     */
49    private final String duplicateDefaultKey; // NOPMD
50  
51    // ****************************** Initializer *******************************
52  
53    // ****************************** Constructors ******************************
54  
55    /**
56     * Technical constructor if no keys are specified.
57     */
58    DuplicateKeys()
59    {
60      this(null, null);
61    }
62  
63    /**
64     * Default constructor.
65     *
66     * @param currentDefaultKey the key that has already been recognized as
67     *          default.
68     * @param duplicateDefaultKey the second key that has been recognized as
69     *          default.
70     */
71    DuplicateKeys(final String currentDefaultKey, final String duplicateDefaultKey)
72    {
73      this.currentDefaultKey = currentDefaultKey;
74      this.duplicateDefaultKey = duplicateDefaultKey;
75    }
76  
77    // ****************************** Inner Classes *****************************
78  
79    // ********************************* Methods ********************************
80  
81    // --- init -----------------------------------------------------------------
82  
83    // --- get&set --------------------------------------------------------------
84  
85    /**
86     * Returns the current default key.
87     *
88     * @return the key that has already been recognized as default.
89     */
90    public String getCurrentDefaultKey()
91    {
92      return currentDefaultKey;
93    }
94  
95    /**
96     * Returns the second key that has been recognized as default. Only one
97     * default key is allowed.
98     *
99     * @return the second key that has been recognized as default.
100    */
101   public String getDuplicateDefaultKey()
102   {
103     return duplicateDefaultKey;
104   }
105 
106   // --- business -------------------------------------------------------------
107 
108   // --- object basics --------------------------------------------------------
109 
110 }