View Javadoc

1   /*
2    * Copyright 2007-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.exceptions.i18n.message;
17  
18  
19  /**
20   * Defines the valid identifiers for message templates.
21   * <p>
22   * Templates are selected to control the rendering of the exception information.
23   * Currently this mechanism is rather crude since the template selects an
24   * implementation during the rendering. In future version a real template should
25   * be supported. That template will contain text that is adorned with
26   * placeholders that will be replaced by concrete messages.
27   * </p>
28   */
29  public enum MessageTemplate
30  {
31    // ****************************** Enumeration *******************************
32  
33    /**
34     * The message's title, summary, and details are rendered in one line.
35     */
36    SINGLE_LINE_STANDARD("singleLine.standard"),
37  
38    /**
39     * The message summary is rendered in one line.
40     */
41    SINGLE_LINE_SUMMARY_ONLY("singleLine.summaryOnly"),
42  
43    /**
44     * Everything is rendered in a multi-line text.
45     */
46    MULTI_LINE_ALL("multiLine.all");
47  
48    // ********************************* Fields *********************************
49  
50    // --- constants ------------------------------------------------------------
51  
52    // --- members --------------------------------------------------------------
53  
54    /**
55     * The identifier of the template.
56     *
57     * @serial
58     */
59    private final String templateId;
60  
61    // ****************************** Constructors ******************************
62  
63    /**
64     * Constructor.
65     *
66     * @param templateId the identifier of the template.
67     */
68    private MessageTemplate(final String templateId)
69    {
70      this.templateId = templateId;
71    }
72  
73    // ********************************* Methods ********************************
74  
75    // --- init -----------------------------------------------------------------
76  
77    // --- get&set --------------------------------------------------------------
78  
79    /**
80     * Returns the identifier of the template.
81     *
82     * @return the identifier of the template.
83     */
84    public String getTemplateId()
85    {
86      return this.templateId;
87    }
88  
89    // --- business -------------------------------------------------------------
90  
91    // --- object basics --------------------------------------------------------
92  
93  }