net.sf.mmm.util.nls.api
Class ComposedException

java.lang.Object
  extended by java.lang.Throwable
      extended by java.lang.Exception
          extended by java.lang.RuntimeException
              extended by net.sf.mmm.util.nls.api.AbstractNlsRuntimeException
                  extended by net.sf.mmm.util.nls.api.NlsRuntimeException
                      extended by net.sf.mmm.util.nls.api.ComposedException
All Implemented Interfaces:
Serializable, NlsObject, NlsThrowable

public class ComposedException
extends NlsRuntimeException

An ComposedException combines a list of exceptions in one single exception. This is helpful if you are validating something and want to collect all errors and throw them as one exception with all information.
Otherwise you would stop at the first error, the user could fix it, restart and end up with the next error and so on.

Since:
2.0.1
Author:
Joerg Hohwiller (hohwille at users.sourceforge.net)
See Also:
Serialized Form

Field Summary
private  Throwable[] errors
          The child errors.
private static long serialVersionUID
          UID for serialization.
 
Fields inherited from interface net.sf.mmm.util.nls.api.NlsObject
KEY_ANNOTATION, KEY_ARGUMENT, KEY_CAPACITY, KEY_DEFAULT, KEY_DIRECTORY, KEY_ERROR, KEY_FILE, KEY_FUNCTION, KEY_ID, KEY_KEY, KEY_LOCATION, KEY_MAX, KEY_MIN, KEY_MODE, KEY_NAME, KEY_OBJECT, KEY_OPERAND, KEY_OPERATION, KEY_OPTION, KEY_PATH, KEY_PROPERTY, KEY_QUERY, KEY_RESOURCE, KEY_SIZE, KEY_SOURCE, KEY_TARGET_TYPE, KEY_TITLE, KEY_TYPE, KEY_URI, KEY_VALUE
 
Constructor Summary
ComposedException(Throwable... errors)
          The constructor.
 
Method Summary
private static NlsMessage createSubMessage(Throwable[] errors)
          This method creates the NlsMessage wrapping the given errors.
 void printStackTrace(Locale locale, NlsTemplateResolver resolver, Appendable buffer)
          This method prints the stack trace with localized exception message(s).
 
Methods inherited from class net.sf.mmm.util.nls.api.NlsRuntimeException
addToMap, toMap, toMap, toMap
 
Methods inherited from class net.sf.mmm.util.nls.api.AbstractNlsRuntimeException
createUuid, getLocalizedMessage, getLocalizedMessage, getLocalizedMessage, getMessage, getNlsMessage, getUuid, printStackTrace, printStackTrace, printStackTrace, toNlsMessage
 
Methods inherited from class java.lang.Throwable
fillInStackTrace, getCause, getLocalizedMessage, getStackTrace, initCause, printStackTrace, setStackTrace, toString
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 
Methods inherited from interface net.sf.mmm.util.nls.api.NlsThrowable
getCause, getStackTrace
 

Field Detail

serialVersionUID

private static final long serialVersionUID
UID for serialization.

See Also:
Constant Field Values

errors

private Throwable[] errors
The child errors.

Constructor Detail

ComposedException

public ComposedException(Throwable... errors)
The constructor.

Parameters:
errors - are the errors that have been collected.
Method Detail

createSubMessage

private static NlsMessage createSubMessage(Throwable[] errors)
This method creates the NlsMessage wrapping the given errors.

Parameters:
errors - are the errors that have been collected.
Returns:
the combined NlsMessage.

printStackTrace

public void printStackTrace(Locale locale,
                            NlsTemplateResolver resolver,
                            Appendable buffer)
This method prints the stack trace with localized exception message(s).

Specified by:
printStackTrace in interface NlsThrowable
Overrides:
printStackTrace in class AbstractNlsRuntimeException
Parameters:
locale - is the locale to translate to.
resolver - translates the original message.
buffer - is where to write the stack trace to.


Copyright © 2001-2010 mmm-Team. All Rights Reserved.