001/* 002 * jDTAUS Banking Messages 003 * Copyright (C) 2005 Christian Schulte 004 * <cs@schulte.it> 005 * 006 * This library is free software; you can redistribute it and/or 007 * modify it under the terms of the GNU Lesser General Public 008 * License as published by the Free Software Foundation; either 009 * version 2.1 of the License, or any later version. 010 * 011 * This library is distributed in the hope that it will be useful, 012 * but WITHOUT ANY WARRANTY; without even the implied warranty of 013 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 014 * Lesser General Public License for more details. 015 * 016 * You should have received a copy of the GNU Lesser General Public 017 * License along with this library; if not, write to the Free Software 018 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA 019 * 020 */ 021package org.jdtaus.banking.messages; 022 023import java.util.Locale; 024import org.jdtaus.banking.Bankleitzahl; 025import org.jdtaus.banking.BankleitzahlInfo; 026import org.jdtaus.core.container.ContainerFactory; 027import org.jdtaus.core.text.Message; 028 029/** 030 * Message stating that a Bankleitzahl has been published as a replacement for an expired Bankleitzahl. 031 * 032 * @author <a href="mailto:cs@schulte.it">Christian Schulte</a> 033 * @version $JDTAUS: BankleitzahlReplacementMessage.java 8810 2012-12-04 00:45:37Z schulte $ 034 */ 035public final class BankleitzahlReplacementMessage extends Message 036{ 037 038 /** Serial version UID for backwards compatibility with 1.2.x classes. */ 039 private static final long serialVersionUID = -4309551284229560988L; 040 041 /** 042 * Information regarding the replacement Bankleitzahl. 043 * @serial 044 */ 045 private final BankleitzahlInfo info; 046 047 /** 048 * Creates a new {@code BankleitzahlReplacementMessage} taking information about a replacement Bankleitzahl. 049 * 050 * @param info Information regarding the replacement Bankleitzahl. 051 * 052 * @throws NullPointerException if {@code info} is {@code null}. 053 */ 054 public BankleitzahlReplacementMessage( final BankleitzahlInfo info ) 055 { 056 if ( info == null ) 057 { 058 throw new NullPointerException( "info" ); 059 } 060 061 this.info = info; 062 } 063 064 /** 065 * {@inheritDoc} 066 * 067 * @return Information regarding the replacement Bankleitzahl. 068 * <ul> 069 * <li>[0]: the replacement Bankleitzahl.</li> 070 * </ul> 071 */ 072 public Object[] getFormatArguments( final Locale locale ) 073 { 074 return new Object[] 075 { 076 this.info.getBankCode().format( Bankleitzahl.LETTER_FORMAT ) 077 }; 078 } 079 080 /** 081 * {@inheritDoc} 082 * 083 * @return The corresponding text from the message's {@code ResourceBundle} 084 * <blockquote><pre> 085 * The bank has published the replacement Bankleitzahl {0}. 086 * </pre></blockquote> 087 */ 088 public String getText( final Locale locale ) 089 { 090 return this.getBankleitzahlReplacementMessage( 091 locale, this.info.getBankCode().format( Bankleitzahl.LETTER_FORMAT ) ); 092 093 } 094 095 //--Messages---------------------------------------------------------------- 096 097// <editor-fold defaultstate="collapsed" desc=" Generated Code ">//GEN-BEGIN:jdtausMessages 098 // This section is managed by jdtaus-container-mojo. 099 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}