com.virtuosotechnologies.lib.error
Class DefaultUserMessageGenerator

java.lang.Object
  extended bycom.virtuosotechnologies.lib.error.DefaultUserMessageGenerator
All Implemented Interfaces:
UserMessageGenerator

public class DefaultUserMessageGenerator
extends Object
implements UserMessageGenerator

Default implementation of UserMessageGenerator.

The template accepts the following parameters:

This class is fully synchronized and thread-safe.


Constructor Summary
DefaultUserMessageGenerator(Class cls)
          Constructor.
DefaultUserMessageGenerator(Class cls, String template)
          Constructor
 
Method Summary
 String format(Throwable ex, PropertySet properties, ExceptionFormatter formatter)
          Generate a String representation of the given exception.
 Class getUnderstoodClass()
          Get the class that this generator understands
 void setExceptionTemplate(String template)
          Set the template for exceptions
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

DefaultUserMessageGenerator

public DefaultUserMessageGenerator(Class cls)
Constructor. Uses the default template.

Parameters:
cls - Class that this generator recognizes.

DefaultUserMessageGenerator

public DefaultUserMessageGenerator(Class cls,
                                   String template)
Constructor

Parameters:
cls - Class that this generator recognizes.
template - template string.
Method Detail

setExceptionTemplate

public void setExceptionTemplate(String template)
Set the template for exceptions

Parameters:
template - new template String

format

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

Specified by:
format in interface UserMessageGenerator
Parameters:
ex - throwable
properties - formatter-specific properties.
formatter - the ExceptionFormatter that called this method
Returns:
a formatted String.

getUnderstoodClass

public Class getUnderstoodClass()
Get the class that this generator understands

Specified by:
getUnderstoodClass in interface UserMessageGenerator
Returns:
a Class object.