org.jdtaus.banking.dtaus.IllegalTransactionException Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of jdtaus-banking-api Show documentation
Show all versions of jdtaus-banking-api Show documentation
jDTAUS banking application programming interface.
/*
* jDTAUS Banking API
* Copyright (C) 2005 Christian Schulte
*
*
* 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.dtaus;
import java.util.Locale;
import org.jdtaus.core.container.ContainerFactory;
import org.jdtaus.core.text.Message;
/**
* Gets thrown whenever an illegal transaction is passed to a method expecting a legal transaction.
* Example: Catching an {@code IllegalTransactionException}
*
* catch(IllegalTransactionException e)
* {
* if(e.getMessages().length > 0)
* {
* Fetch messages for well-known properties first (optional).
* e.getMessages(Transaction.PROP_XYZ);
* ...
* Fetch all remaining messages.
* e.getMessages();
* ...
* }
* }
*
* @author Christian Schulte
* @version $JDTAUS: IllegalTransactionException.java 8661 2012-09-27 11:29:58Z schulte $
*/
public abstract class IllegalTransactionException extends IllegalArgumentException
{
/** Serial version UID for backwards compatibility with 1.0.x classes. */
private static final long serialVersionUID = 2094280705320453233L;
/** Creates a new {@code IllegalTransactionException} instance. */
public IllegalTransactionException()
{
super();
}
/**
* Gets all messages describing the exception.
*
* @return An array of messages describing the exception or an empty array if the instance does not hold any
* messages.
*/
public abstract Message[] getMessages();
/**
* Gets messages bound to a property removing these messages from the instance.
*
* @param propertyName the name of a property to return any messages for.
*
* @return All messages bound to a property with name {@code propertyName} or an empty array if the instance does
* not hold messages for a property with name {@code propertyName}.
*
* @throws NullPointerException if {@code propertyName} is {@code null}.
*/
public abstract Message[] getMessages( final String propertyName );
/**
* Gets the names of all properties for which the exception holds messages.
*
* @return An array of the names of all properties for which the exception holds messages or an empty array if the
* exception does not hold any message bound to a property.
*/
public abstract String[] getPropertyNames();
/**
* Returns the message of the exception.
*
* @return The message of the exception.
*/
public String getMessage()
{
return this.getIllegalTransactionMessage( this.getLocale() );
}
//--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 illegalTransaction
.
* Ungültiger "C" Datensatz.
* Illegal "C" record.
*
* @param locale The locale of the message instance to return.
*
* @return the text of message illegalTransaction
.
*/
private String getIllegalTransactionMessage( final Locale locale )
{
return ContainerFactory.getContainer().
getMessage( this, "illegalTransaction", locale, null );
}
// //GEN-END:jdtausMessages
//----------------------------------------------------------------Messages--
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy