| 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.math.BigInteger; |
| 24 | import java.util.Locale; |
| 25 | import org.jdtaus.core.container.ContainerFactory; |
| 26 | import org.jdtaus.core.text.Message; |
| 27 | |
| 28 | /** |
| 29 | * Message stating that an amount is invalid. |
| 30 | * |
| 31 | * @author <a href="mailto:cs@schulte.it">Christian Schulte</a> |
| 32 | * @version $JDTAUS: IllegalAmountMessage.java 8810 2012-12-04 00:45:37Z schulte $ |
| 33 | */ |
| 34 | public final class IllegalAmountMessage extends Message |
| 35 | { |
| 36 | |
| 37 | /** Serial version UID for backwards compatibility with 1.0.x classes. */ |
| 38 | private static final long serialVersionUID = 1922186182644325080L; |
| 39 | |
| 40 | /** |
| 41 | * The illegal amount. |
| 42 | * @serial |
| 43 | */ |
| 44 | private final BigInteger amount; |
| 45 | |
| 46 | /** |
| 47 | * Creates a new {@code IllegalAmountMessage} taking an amount. |
| 48 | * |
| 49 | * @param amount The illegal amount. |
| 50 | * |
| 51 | * @throws NullPointerException if {@code amount} is {@code null}. |
| 52 | */ |
| 53 | public IllegalAmountMessage( final BigInteger amount ) |
| 54 | { |
| 55 | super(); |
| 56 | |
| 57 | if ( amount == null ) |
| 58 | { |
| 59 | throw new NullPointerException( "amount" ); |
| 60 | } |
| 61 | |
| 62 | this.amount = amount; |
| 63 | } |
| 64 | |
| 65 | /** |
| 66 | * {@inheritDoc} |
| 67 | * |
| 68 | * @return The illegal amount. |
| 69 | * <ul> |
| 70 | * <li>[0]: illegal amount.</li> |
| 71 | * </ul> |
| 72 | */ |
| 73 | public Object[] getFormatArguments( final Locale locale ) |
| 74 | { |
| 75 | return new Object[] |
| 76 | { |
| 77 | this.amount |
| 78 | }; |
| 79 | } |
| 80 | |
| 81 | /** |
| 82 | * {@inheritDoc} |
| 83 | * |
| 84 | * @return The corresponding text from the message's {@code ResourceBundle} |
| 85 | * <blockquote><pre> |
| 86 | * {0,number} is no legal amount. |
| 87 | * </pre></blockquote> |
| 88 | */ |
| 89 | public String getText( final Locale locale ) |
| 90 | { |
| 91 | return this.getIllegalAmountMessage( locale, this.amount ); |
| 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>illegalAmount</code>. |
| 101 | * <blockquote><pre>Ungültiger Betrag {0,number}.</pre></blockquote> |
| 102 | * <blockquote><pre>{0, number} is no legal amount.</pre></blockquote> |
| 103 | * |
| 104 | * @param locale The locale of the message instance to return. |
| 105 | * @param amt format parameter. |
| 106 | * |
| 107 | * @return the text of message <code>illegalAmount</code>. |
| 108 | */ |
| 109 | private String getIllegalAmountMessage( final Locale locale, |
| 110 | final java.lang.Number amt ) |
| 111 | { |
| 112 | return ContainerFactory.getContainer(). |
| 113 | getMessage( this, "illegalAmount", locale, |
| 114 | new Object[] |
| 115 | { |
| 116 | amt |
| 117 | }); |
| 118 | |
| 119 | } |
| 120 | |
| 121 | // </editor-fold>//GEN-END:jdtausMessages |
| 122 | |
| 123 | //----------------------------------------------------------------Messages-- |
| 124 | } |