
org.jdtaus.banking.ri.currencydir.DuplicateCurrencyException Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of jdtaus-banking-ri-currencydirectory Show documentation
Show all versions of jdtaus-banking-ri-currencydirectory Show documentation
jDTAUS CurrencyDirectory reference implementation.
/*
* jDTAUS Banking RI CurrencyDirectory
* Copyright (c) 2005 Christian Schulte
*
* Christian Schulte, Haldener Strasse 72, 58095 Hagen, Germany
* (+49 2331 3543887)
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 2.1 of the License, or any later version.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
*
*/
package org.jdtaus.banking.ri.currencydir;
import java.util.Currency;
import java.util.Locale;
import org.jdtaus.core.container.ContainerFactory;
/**
* Gets thrown for duplicate {@code Currency} instances.
*
* @author Christian Schulte
* @version $Id: DuplicateCurrencyException.java 5863 2008-12-29 22:10:34Z schulte2005 $
*/
public class DuplicateCurrencyException extends RuntimeException
{
//--Constants---------------------------------------------------------------
/** Serial version UID for backwards compatibility with 1.0.x classes. */
private static final long serialVersionUID = 8084715524328704554L;
//---------------------------------------------------------------Constants--
//--DuplicateCurrencyException----------------------------------------------
/***
* The duplicate {@code Currency}.
* @serial
*/
private Currency currency;
/**
* Creates a new instance of {@code DuplicateCurrencyException} taking
* the duplicate {@code Currency} instance.
*
* @param currency the duplicate {@code Currency} instance.
*/
public DuplicateCurrencyException( final Currency currency )
{
super();
this.currency = currency;
}
/**
* Gets the the duplicate {@code Currency} instance.
*
* @return the duplicate {@code Currency} or {@code null}.
*/
public Currency getCurrency()
{
return this.currency;
}
/**
* Returns the message of the exception.
*
* @return the message of the exception.
*/
public String getMessage()
{
return this.getDuplicateCurrencyMessage(
this.getLocale(), this.currency.getCurrencyCode(),
this.currency.getSymbol() );
}
//----------------------------------------------DuplicateCurrencyException--
//--Dependencies------------------------------------------------------------
// //GEN-BEGIN:jdtausDependencies
// This section is managed by jdtaus-container-mojo.
/**
* Gets the configured Locale
implementation.
*
* @return The configured Locale
implementation.
*/
private Locale getLocale()
{
return (Locale) ContainerFactory.getContainer().
getDependency( this, "Locale" );
}
// //GEN-END:jdtausDependencies
//------------------------------------------------------------Dependencies--
//--Messages----------------------------------------------------------------
// //GEN-BEGIN:jdtausMessages
// This section is managed by jdtaus-container-mojo.
/**
* Gets the text of message duplicateCurrency
.
* Währung {1} ({0}) ist mehrfach vorhanden.
* Non-unique currency {1} ({0}).
*
* @param locale The locale of the message instance to return.
* @param currencyCode format argument.
* @param currencySymbol format argument.
*
* @return the text of message duplicateCurrency
.
*/
private String getDuplicateCurrencyMessage( final Locale locale,
final java.lang.String currencyCode,
final java.lang.String currencySymbol )
{
return ContainerFactory.getContainer().
getMessage( this, "duplicateCurrency", locale,
new Object[]
{
currencyCode,
currencySymbol
});
}
// //GEN-END:jdtausMessages
//----------------------------------------------------------------Messages--
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy