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.banking.BankleitzahlInfo; |
26 | import org.jdtaus.core.container.ContainerFactory; |
27 | import org.jdtaus.core.text.Message; |
28 | |
29 | /** |
30 | * Message stating that a Bankleitzahl has been published as a replacement for an expired Bankleitzahl. |
31 | * |
32 | * @author <a href="mailto:cs@schulte.it">Christian Schulte</a> |
33 | * @version $JDTAUS: BankleitzahlReplacementMessage.java 8810 2012-12-04 00:45:37Z schulte $ |
34 | */ |
35 | public final class BankleitzahlReplacementMessage extends Message |
36 | { |
37 | |
38 | /** Serial version UID for backwards compatibility with 1.2.x classes. */ |
39 | private static final long serialVersionUID = -4309551284229560988L; |
40 | |
41 | /** |
42 | * Information regarding the replacement Bankleitzahl. |
43 | * @serial |
44 | */ |
45 | private final BankleitzahlInfo info; |
46 | |
47 | /** |
48 | * Creates a new {@code BankleitzahlReplacementMessage} taking information about a replacement Bankleitzahl. |
49 | * |
50 | * @param info Information regarding the replacement Bankleitzahl. |
51 | * |
52 | * @throws NullPointerException if {@code info} is {@code null}. |
53 | */ |
54 | public BankleitzahlReplacementMessage( final BankleitzahlInfo info ) |
55 | { |
56 | if ( info == null ) |
57 | { |
58 | throw new NullPointerException( "info" ); |
59 | } |
60 | |
61 | this.info = info; |
62 | } |
63 | |
64 | /** |
65 | * {@inheritDoc} |
66 | * |
67 | * @return Information regarding the replacement Bankleitzahl. |
68 | * <ul> |
69 | * <li>[0]: the replacement Bankleitzahl.</li> |
70 | * </ul> |
71 | */ |
72 | public Object[] getFormatArguments( final Locale locale ) |
73 | { |
74 | return new Object[] |
75 | { |
76 | this.info.getBankCode().format( Bankleitzahl.LETTER_FORMAT ) |
77 | }; |
78 | } |
79 | |
80 | /** |
81 | * {@inheritDoc} |
82 | * |
83 | * @return The corresponding text from the message's {@code ResourceBundle} |
84 | * <blockquote><pre> |
85 | * The bank has published the replacement Bankleitzahl {0}. |
86 | * </pre></blockquote> |
87 | */ |
88 | public String getText( final Locale locale ) |
89 | { |
90 | return this.getBankleitzahlReplacementMessage( |
91 | locale, this.info.getBankCode().format( Bankleitzahl.LETTER_FORMAT ) ); |
92 | |
93 | } |
94 | |
95 | //--Messages---------------------------------------------------------------- |
96 | |
97 | // <editor-fold defaultstate="collapsed" desc=" Generated Code ">//GEN-BEGIN:jdtausMessages |
98 | // This section is managed by jdtaus-container-mojo. |
99 | |
100 | /** |
101 | * Gets the text of message <code>bankleitzahlReplacement</code>. |
102 | * <blockquote><pre>Die Bank hat die Bankleitzahl {0} als Nachfolge veröffentlicht.</pre></blockquote> |
103 | * <blockquote><pre>The bank has published the replacement Bankleitzahl {0}.</pre></blockquote> |
104 | * |
105 | * @param locale The locale of the message instance to return. |
106 | * @param bankleitzahl format parameter. |
107 | * |
108 | * @return the text of message <code>bankleitzahlReplacement</code>. |
109 | */ |
110 | private String getBankleitzahlReplacementMessage( final Locale locale, |
111 | final java.lang.String bankleitzahl ) |
112 | { |
113 | return ContainerFactory.getContainer(). |
114 | getMessage( this, "bankleitzahlReplacement", locale, |
115 | new Object[] |
116 | { |
117 | bankleitzahl |
118 | }); |
119 | |
120 | } |
121 | |
122 | // </editor-fold>//GEN-END:jdtausMessages |
123 | |
124 | //----------------------------------------------------------------Messages-- |
125 | } |