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.core.container.ContainerFactory;
026import org.jdtaus.core.text.Message;
027
028/**
029 * Message stating that Bankleitzahl is unknown.
030 *
031 * @author <a href="mailto:cs@schulte.it">Christian Schulte</a>
032 * @version $JDTAUS: UnknownBankleitzahlMessage.java 8810 2012-12-04 00:45:37Z schulte $
033 */
034public final class UnknownBankleitzahlMessage extends Message
035{
036
037    /** Serial version UID for backwards compatibility with 1.1.x classes. */
038    private static final long serialVersionUID = -7923064314185101629L;
039
040    /**
041     * Bankleitzahl of the message.
042     * @serial
043     */
044    private final Bankleitzahl bankCode;
045
046    /**
047     * Creates a new {@code UnknownBankleitzahlMessage} taking the unknown Bankleitzahl.
048     *
049     * @param bankCode The unknown Bankleitzahl.
050     *
051     * @throws NullPointerException if {@code bankCode} is {@code null}.
052     */
053    public UnknownBankleitzahlMessage( final Bankleitzahl bankCode )
054    {
055        if ( bankCode == null )
056        {
057            throw new NullPointerException( "bankCode" );
058        }
059
060        this.bankCode = bankCode;
061    }
062
063    /**
064     * {@inheritDoc}
065     *
066     * @return Information regarding the unknown Bankleitzahl.
067     * <ul>
068     * <li>[0]: the unknown Bankleitzahl.</li>
069     * </ul>
070     */
071    public Object[] getFormatArguments( final Locale locale )
072    {
073        return new Object[]
074            {
075                this.bankCode.format( Bankleitzahl.LETTER_FORMAT )
076            };
077    }
078
079    /**
080     * {@inheritDoc}
081     *
082     * @return The corresponding text from the message's {@code ResourceBundle}
083     * <blockquote><pre>
084     * Unknown Bankleitzahl {0}.
085     * </pre></blockquote>
086     */
087    public String getText( final Locale locale )
088    {
089        return this.getUnknownBankleitzahlMessage(
090            locale, this.bankCode.format( Bankleitzahl.LETTER_FORMAT ) );
091
092    }
093
094    //--Messages----------------------------------------------------------------
095
096// <editor-fold defaultstate="collapsed" desc=" Generated Code ">//GEN-BEGIN:jdtausMessages
097    // This section is managed by jdtaus-container-mojo.
098
099    /**
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}