View Javadoc

1   /*
2    * WARNING: Generated code. All changes will be lost upon re-generation.
3    *
4    * Generator org.jdtaus.mojo.resource.util.BundleGenerator 3.3
5    * Template META-INF/templates/Bundle.java.vm
6    * Generated 2012-12-03T20:50:43.515+0100
7    */
8   package org.jdtaus.core.text;
9   
10  import java.util.Locale;
11  import java.util.ResourceBundle;
12  import java.text.MessageFormat;
13  
14  /**
15   * Accessor methods for the <code>"org/jdtaus/core/text/MessageEventBundle"</code>
16   * <code>ResourceBundle</code>.
17   */
18  class MessageEventBundle
19  {
20  
21    /** Singleton instance. */
22    private static final MessageEventBundle instance =
23      new MessageEventBundle();
24  
25    /** Creates a new <code>MessageEventBundle</code> instance. */
26    MessageEventBundle()
27    {
28      this.getMessage ( "missingMessages", Locale.getDefault() );
29    }
30  
31    /**
32     * Gets the <code>MessageEventBundle</code> singleton.
33     *
34     * @return The <code>MessageEventBundle</code> singleton.
35     */
36    static MessageEventBundle getInstance()
37    {
38      return instance;
39    }
40  
41    /**
42     * Gets the text of the message with key {@code "missingMessages"}.
43     *
44     * @return <blockquote><pre>Could not deserialize any messages.</pre></blockquote>
45     * <blockquote><pre>Es konnten keine Message-Instanzen deserialisiert werden.</pre></blockquote>
46     * 
47     */
48    String getMissingMessagesMessage
49    (
50        Locale locale
51    )
52    {
53      if ( locale == null )
54      {
55        locale = Locale.getDefault();
56      }
57  
58      return new MessageFormat( this.getMessage(
59          "missingMessages", locale ), locale ).format(
60          new Object[]
61          {
62              null
63          } );
64  
65    }
66  
67    /**
68     * Gets a message for a given key and locale.
69     *
70     * @param key The key of the message to return.
71     * @param locale The locale of the message.
72     *
73     * @return Message for {@code key} using {@code locale}.
74     */
75    private String getMessage( final String key, Locale locale )
76    {
77      if ( locale == null )
78      {
79        locale = Locale.getDefault();
80      }
81  
82      return ResourceBundle.getBundle(
83          "org/jdtaus/core/text/MessageEventBundle", locale ).
84          getString( key );
85  
86    }
87  }