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.Date;
024import java.util.Locale;
025import org.jdtaus.core.container.ContainerFactory;
026import org.jdtaus.core.text.Message;
027
028/**
029 * Message stating that the {@code BundesbankBankleitzahlenVerzeichnis} is
030 * outdated.
031 *
032 * @author <a href="mailto:cs@schulte.it">Christian Schulte</a>
033 * @version $JDTAUS: OutdatedBankleitzahlenVerzeichnisMessage.java 8865 2014-01-10 17:13:42Z schulte $
034 */
035public final class OutdatedBankleitzahlenVerzeichnisMessage extends Message
036{
037
038    /** Serial version UID for backwards compatibility with 1.0.x classes. */
039    private static final long serialVersionUID = -196759846361567335L;
040
041    /**
042     * Date of expiration of the directory.
043     * @serial
044     */
045    private final Date dateOfExpiration;
046
047    /**
048     * Creates a new {@code OutdatedDirectoryMessage} instance taking the date of expiration.
049     *
050     * @param dateOfExpiration the date of expiration of the directory.
051     *
052     * @throws NullPointerException if {@code dateOfExpiration} is {@code null}.
053     */
054    public OutdatedBankleitzahlenVerzeichnisMessage( final Date dateOfExpiration )
055    {
056        if ( dateOfExpiration == null )
057        {
058            throw new NullPointerException( "dateOfExpiration" );
059        }
060
061        this.dateOfExpiration = (Date) dateOfExpiration.clone();
062    }
063
064    /**
065     * {@inheritDoc}
066     *
067     * @return The date of expiration of the {@code BankleitzahlenVerzeichnis}.
068     * <ul>
069     * <li>[0]: the date of expiration of the directory.</li>
070     * </ul>
071     */
072    public Object[] getFormatArguments( final Locale locale )
073    {
074        return new Object[]
075            {
076                this.dateOfExpiration
077            };
078    }
079
080    /**
081     * {@inheritDoc}
082     *
083     * @return The corresponding text from the message's {@code ResourceBundle}
084     * <blockquote><pre>
085     * The directory of bankcodes expired at {0,date,long}.
086     * </pre></blockquote>
087     */
088    public String getText( final Locale locale )
089    {
090        return this.getOutdatedDirectoryMessage( locale, this.dateOfExpiration );
091    }
092
093    //--Messages----------------------------------------------------------------
094
095// <editor-fold defaultstate="collapsed" desc=" Generated Code ">//GEN-BEGIN:jdtausMessages
096    // This section is managed by jdtaus-container-mojo.
097
098    /**
099     * Gets the text of message <code>outdatedDirectory</code>.
100     * <blockquote><pre>Das Bankleitzahlenverzeichnis ist am {0,date,long} abgelaufen.</pre></blockquote>
101     * <blockquote><pre>The directory of bankcodes expired at {0,date,long}.</pre></blockquote>
102     *
103     * @param locale The locale of the message instance to return.
104     * @param expirationDate format parameter.
105     *
106     * @return the text of message <code>outdatedDirectory</code>.
107     */
108    private String getOutdatedDirectoryMessage( final Locale locale,
109            final java.util.Date expirationDate )
110    {
111        return ContainerFactory.getContainer().
112            getMessage( this, "outdatedDirectory", locale,
113                new Object[]
114                {
115                    expirationDate
116                });
117
118    }
119
120// </editor-fold>//GEN-END:jdtausMessages
121
122    //----------------------------------------------------------------Messages--
123}