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.math.BigInteger; 024import java.util.Locale; 025import org.jdtaus.core.container.ContainerFactory; 026import org.jdtaus.core.text.Message; 027 028/** 029 * Message stating that an amount is invalid. 030 * 031 * @author <a href="mailto:cs@schulte.it">Christian Schulte</a> 032 * @version $JDTAUS: IllegalAmountMessage.java 8810 2012-12-04 00:45:37Z schulte $ 033 */ 034public final class IllegalAmountMessage extends Message 035{ 036 037 /** Serial version UID for backwards compatibility with 1.0.x classes. */ 038 private static final long serialVersionUID = 1922186182644325080L; 039 040 /** 041 * The illegal amount. 042 * @serial 043 */ 044 private final BigInteger amount; 045 046 /** 047 * Creates a new {@code IllegalAmountMessage} taking an amount. 048 * 049 * @param amount The illegal amount. 050 * 051 * @throws NullPointerException if {@code amount} is {@code null}. 052 */ 053 public IllegalAmountMessage( final BigInteger amount ) 054 { 055 super(); 056 057 if ( amount == null ) 058 { 059 throw new NullPointerException( "amount" ); 060 } 061 062 this.amount = amount; 063 } 064 065 /** 066 * {@inheritDoc} 067 * 068 * @return The illegal amount. 069 * <ul> 070 * <li>[0]: illegal amount.</li> 071 * </ul> 072 */ 073 public Object[] getFormatArguments( final Locale locale ) 074 { 075 return new Object[] 076 { 077 this.amount 078 }; 079 } 080 081 /** 082 * {@inheritDoc} 083 * 084 * @return The corresponding text from the message's {@code ResourceBundle} 085 * <blockquote><pre> 086 * {0,number} is no legal amount. 087 * </pre></blockquote> 088 */ 089 public String getText( final Locale locale ) 090 { 091 return this.getIllegalAmountMessage( locale, this.amount ); 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>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}