com.virtuosotechnologies.lib.error
Class SimpleUserMessageGenerator

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

public class SimpleUserMessageGenerator
extends Object
implements UserMessageGenerator

Simple implementation of UserMessageGenerator.

The template accepts the following parameters:

This class is fully synchronized and thread-safe.


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

Method Detail

create

public static SimpleUserMessageGenerator create(Class cls,
                                                String messageString)
Pseudo-Constructor

Parameters:
cls - Class that this generator recognizes.
messageString - message string for this exception.

createWithType

public static SimpleUserMessageGenerator createWithType(Class cls,
                                                        String messageString)
Pseudo-Constructor

Parameters:
cls - Class that this generator recognizes.
messageString - message string for this exception.

setExceptionTemplate

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

Parameters:
template - new template String

getMessageString

public String getMessageString()
Get the message string

Returns:
message String

setMessageString

public void setMessageString(String messageString)
Set the message string

Parameters:
messageString - new message 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.