View Javadoc

1   /*
2    *  jDTAUS Banking Messages
3    *  Copyright (C) 2005 Christian Schulte
4    *  <cs@schulte.it>
5    *
6    *  This library is free software; you can redistribute it and/or
7    *  modify it under the terms of the GNU Lesser General Public
8    *  License as published by the Free Software Foundation; either
9    *  version 2.1 of the License, or any later version.
10   *
11   *  This library is distributed in the hope that it will be useful,
12   *  but WITHOUT ANY WARRANTY; without even the implied warranty of
13   *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
14   *  Lesser General Public License for more details.
15   *
16   *  You should have received a copy of the GNU Lesser General Public
17   *  License along with this library; if not, write to the Free Software
18   *  Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
19   *
20   */
21  package org.jdtaus.banking.messages;
22  
23  import java.util.Locale;
24  import org.jdtaus.banking.Bankleitzahl;
25  import org.jdtaus.core.container.ContainerFactory;
26  import org.jdtaus.core.text.Message;
27  
28  /**
29   * Message stating that Bankleitzahl is unknown.
30   *
31   * @author <a href="mailto:cs@schulte.it">Christian Schulte</a>
32   * @version $JDTAUS: UnknownBankleitzahlMessage.java 8810 2012-12-04 00:45:37Z schulte $
33   */
34  public final class UnknownBankleitzahlMessage extends Message
35  {
36  
37      /** Serial version UID for backwards compatibility with 1.1.x classes. */
38      private static final long serialVersionUID = -7923064314185101629L;
39  
40      /**
41       * Bankleitzahl of the message.
42       * @serial
43       */
44      private final Bankleitzahl bankCode;
45  
46      /**
47       * Creates a new {@code UnknownBankleitzahlMessage} taking the unknown Bankleitzahl.
48       *
49       * @param bankCode The unknown Bankleitzahl.
50       *
51       * @throws NullPointerException if {@code bankCode} is {@code null}.
52       */
53      public UnknownBankleitzahlMessage( final Bankleitzahl bankCode )
54      {
55          if ( bankCode == null )
56          {
57              throw new NullPointerException( "bankCode" );
58          }
59  
60          this.bankCode = bankCode;
61      }
62  
63      /**
64       * {@inheritDoc}
65       *
66       * @return Information regarding the unknown Bankleitzahl.
67       * <ul>
68       * <li>[0]: the unknown Bankleitzahl.</li>
69       * </ul>
70       */
71      public Object[] getFormatArguments( final Locale locale )
72      {
73          return new Object[]
74              {
75                  this.bankCode.format( Bankleitzahl.LETTER_FORMAT )
76              };
77      }
78  
79      /**
80       * {@inheritDoc}
81       *
82       * @return The corresponding text from the message's {@code ResourceBundle}
83       * <blockquote><pre>
84       * Unknown Bankleitzahl {0}.
85       * </pre></blockquote>
86       */
87      public String getText( final Locale locale )
88      {
89          return this.getUnknownBankleitzahlMessage(
90              locale, this.bankCode.format( Bankleitzahl.LETTER_FORMAT ) );
91  
92      }
93  
94      //--Messages----------------------------------------------------------------
95  
96  // <editor-fold defaultstate="collapsed" desc=" Generated Code ">//GEN-BEGIN:jdtausMessages
97      // This section is managed by jdtaus-container-mojo.
98  
99      /**
100      * Gets the text of message <code>unknownBankleitzahl</code>.
101      * <blockquote><pre>Unbekannte Bankleitzahl {0}.</pre></blockquote>
102      * <blockquote><pre>Unknown Bankleitzahl {0}.</pre></blockquote>
103      *
104      * @param locale The locale of the message instance to return.
105      * @param unknownBankleitzahl format parameter.
106      *
107      * @return the text of message <code>unknownBankleitzahl</code>.
108      */
109     private String getUnknownBankleitzahlMessage( final Locale locale,
110             final java.lang.String unknownBankleitzahl )
111     {
112         return ContainerFactory.getContainer().
113             getMessage( this, "unknownBankleitzahl", locale,
114                 new Object[]
115                 {
116                     unknownBankleitzahl
117                 });
118 
119     }
120 
121 // </editor-fold>//GEN-END:jdtausMessages
122 
123     //----------------------------------------------------------------Messages--
124 }