com.virtuosotechnologies.lib.error
Class SimpleExceptionFormatter

java.lang.Object
  extended bycom.virtuosotechnologies.lib.error.SimpleExceptionFormatter
All Implemented Interfaces:
ExceptionFormatter

public class SimpleExceptionFormatter
extends Object
implements ExceptionFormatter

Simple exception formatter.

The templates are of MessageFormat pattern type, where parameter 0 is replaced by the toString() form of the exception.

This class is fully synchronized and thread-safe.


Constructor Summary
SimpleExceptionFormatter()
          Construct a formatter using the default templates
 
Method Summary
 String format(Throwable ex, PropertySet properties)
          Generate a String representation of the given exception.
 void setFirstTemplate(String template)
          Set the template for first exception
 void setNextTemplate(String template)
          Set the template for next exception
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

SimpleExceptionFormatter

public SimpleExceptionFormatter()
Construct a formatter using the default templates

Method Detail

setFirstTemplate

public void setFirstTemplate(String template)
Set the template for first exception

Parameters:
template - new template String

setNextTemplate

public void setNextTemplate(String template)
Set the template for next exception

Parameters:
template - new template String

format

public String format(Throwable ex,
                     PropertySet properties)
Generate a String representation of the given exception.

Specified by:
format in interface ExceptionFormatter
Parameters:
ex - throwable
properties - formatter-specific properties.
Returns:
a formatted String.