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;
17  
18  import de.smartics.exceptions.core.CodeMessageFormatter;
19  
20  /**
21   * Formatter for instances of {@link MessageBean}.
22   */
23  public interface I18nCodeMessageFormatter extends CodeMessageFormatter
24  {
25    // ********************************* Fields *********************************
26  
27    // --- constants ------------------------------------------------------------
28  
29    // ****************************** Initializer *******************************
30  
31    // ****************************** Inner Classes *****************************
32  
33    // ********************************* Methods ********************************
34  
35    // --- get&set --------------------------------------------------------------
36  
37    // --- business -------------------------------------------------------------
38  
39    /**
40     * Formats the given exception.
41     * <p>
42     * Implementations must not use the <code>toString</code> method of the given
43     * {@code exception} since the instance delegates its <code>toString</code>
44     * method call to this instance.
45     * </p>
46     *
47     * @param exception the exception to transform to its string representation.
48     * @return the string representation of the exception.
49     */
50    String format(LocalizedException exception);
51  
52    /**
53     * Formats the given message.
54     * <p>
55     * Implementations must not use the <code>toString</code> method of the given
56     * {@code message} since the instance delegates its <code>toString</code>
57     * method call to this instance.
58     * </p>
59     *
60     * @param exception the exception to transform to its string representation.
61     * @param message the message to transform to be added to the string representation.
62     * @return the string representation of the exception.
63     */
64    String format(LocalizedException exception, MessageBean message);
65  
66    /**
67     * Formats the given message.
68     * <p>
69     * Implementations must not use the <code>toString</code> method of the given
70     * {@code message} since the instance delegates its <code>toString</code>
71     * method call to this instance.
72     * </p>
73     *
74     * @param message the message to transform to its string representation.
75     * @return the string representation of the exception.
76     */
77    String format(MessageBean message);
78  
79    // --- object basics --------------------------------------------------------
80  
81  }