org.apache.commons.math.exception
Interface MathThrowable

All Known Implementing Classes:
CardanEulerSingularityException, ConvergenceException, EventException, FractionConversionException, IntegratorException, MathConfigurationException, MathException, MathRuntimeException, MathRuntimeException, MaxEvaluationsExceededException, NoFeasibleSolutionException, NotARotationMatrixException, OptimizationException, UnboundedSolutionException

public interface MathThrowable

Interface for commons-math throwables.

Since:
2.2
Version:
$Id: MathThrowable.java 1131229 2011-06-03 20:49:25Z luc $

Method Summary
 void addMessage(Localizable pattern, Object... arguments)
          Sets a message.
 Object getContext(String key)
          Gets the value associated to the given context key.
 Set<String> getContextKeys()
          Gets all the keys stored in the exception
 String getLocalizedMessage()
          Gets the message in the system default locale.
 String getMessage()
          Gets the message in a conventional US locale.
 String getMessage(Locale locale)
          Gets the message in a specified locale.
 void setContext(String key, Object value)
          Sets the context (key, value) pair.
 

Method Detail

addMessage

void addMessage(Localizable pattern,
                Object... arguments)
Sets a message.

Parameters:
pattern - Message pattern.
arguments - Values for replacing the placeholders in the message pattern.

setContext

void setContext(String key,
                Object value)
Sets the context (key, value) pair. Keys are assumed to be unique within an instance. If the same key is assigned a new value, the previous one will be lost.

Parameters:
key - Context key (not null).
value - Context value.

getContext

Object getContext(String key)
Gets the value associated to the given context key.

Parameters:
key - Context key.
Returns:
the context value or null if the key does not exist.

getContextKeys

Set<String> getContextKeys()
Gets all the keys stored in the exception

Returns:
the set of keys.

getMessage

String getMessage(Locale locale)
Gets the message in a specified locale.

Parameters:
locale - Locale in which the message should be translated
Returns:
localized message

getMessage

String getMessage()
Gets the message in a conventional US locale.

Returns:
localized message

getLocalizedMessage

String getLocalizedMessage()
Gets the message in the system default locale.

Returns:
localized message


Copyright © 2003-2011 The Apache Software Foundation. All Rights Reserved.