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.integration.cdi;
17  
18  import de.smartics.exceptions.code.NumberCode;
19  import de.smartics.exceptions.code.NumberCodeInfo;
20  
21  /**
22   * Enumeration of the configuration validation exception codes.
23   */
24  public enum ConfigurationValidationNumberCode implements NumberCode
25  {
26  
27    // ***************************** Enumeration ******************************
28  
29    /**
30     * No class has been annotated with the marker annotation {@link Application}.
31     */
32    MARKER_ANNOTATION_NOT_FOUND(0),
33  
34    /**
35     * More than one class has been annotated with the marker annotation
36     * {@link Application}.
37     */
38    TOO_MANY_CLASSES_ANNOTATED(1);
39  
40    // ******************************** Fields ********************************
41  
42    // --- constants ----------------------------------------------------------
43  
44    // --- members ------------------------------------------------------------
45  
46    /**
47     * The code information.
48     */
49    private final NumberCodeInfo info;
50  
51    // ***************************** Constructors *****************************
52  
53    /**
54     * Default constructor.
55     *
56     * @param minorNumber the minor part of the error code.
57     */
58    private ConfigurationValidationNumberCode(final Integer minorNumber)
59    {
60      this.info =
61          new NumberCodeInfo("smartics-prioperties-integration-cdi-validation",
62              ApplicationNumberCode.VALIDATION_CODE_START, minorNumber);
63    }
64  
65    // ******************************** Methods *******************************
66  
67    // --- init ---------------------------------------------------------------
68  
69    // --- get&set ------------------------------------------------------------
70  
71    /**
72     * {@inheritDoc}
73     */
74    public String getCode()
75    {
76      return info.getCode();
77    }
78  
79    /**
80     * {@inheritDoc}
81     */
82    public String getComponentId()
83    {
84      return info.getComponentId();
85    }
86  
87    /**
88     * {@inheritDoc}
89     *
90     * @see de.smartics.exceptions.core.Code#getDisplayId()
91     */
92    public String getDisplayId()
93    {
94      return info.toString();
95    }
96  
97    /**
98     * {@inheritDoc}
99     *
100    * @see de.smartics.exceptions.code.NumberCode#getMajorNumber()
101    */
102   public Integer getMajorNumber()
103   {
104     return info.getMajorNumber();
105   }
106 
107   /**
108    * {@inheritDoc}
109    *
110    * @see de.smartics.exceptions.code.NumberCode#getMinorNumber()
111    */
112   public Integer getMinorNumber()
113   {
114     return info.getMinorNumber();
115   }
116 
117   // --- business -----------------------------------------------------------
118 
119   // --- object basics ------------------------------------------------------
120 
121   /**
122    * Returns the string representation of the object.
123    *
124    * @return the string representation of the object.
125    */
126   @Override
127   public String toString()
128   {
129     return getDisplayId();
130   }
131 }