freemarker.template
Class TemplateExceptionEvent

java.lang.Object
  |
  +--java.util.EventObject
        |
        +--freemarker.template.TemplateExceptionEvent
All Implemented Interfaces:
java.io.Serializable

public final class TemplateExceptionEvent
extends java.util.EventObject

Event object that is thrown at runtime whenever an exceptional situation occurs.

Version:
$Id$
See Also:
TemplateExceptionListener, TemplateRuntimeHandler, Serialized Form

Fields inherited from class java.util.EventObject
source
 
Constructor Summary
TemplateExceptionEvent(java.lang.Object source, java.lang.Exception e, java.io.Writer output, java.lang.String sourceName, int severity)
          Creates new TemplateExceptionEvent.
 
Method Summary
 java.lang.Exception getException()
          The exception that caused this event to be fired.
 java.io.PrintWriter getOutput()
          Deprecated. use the getWriter() method for maximum efficiency, since this method now has to wrap the underlying Writer in a PrintWriter object
 int getSeverity()
          Retrieve the severity, such as TemplateRuntimeHandler.SEVERITY_ERROR.
 java.lang.String getSourceName()
          Get the name of the source, such as freemarker.template.Template.process
 java.io.Writer getWriter()
          Get the Template's current Writer.
 
Methods inherited from class java.util.EventObject
getSource, toString
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

TemplateExceptionEvent

public TemplateExceptionEvent(java.lang.Object source,
                              java.lang.Exception e,
                              java.io.Writer output,
                              java.lang.String sourceName,
                              int severity)
Creates new TemplateExceptionEvent.
Parameters:
source - the source of the event
e - the exception that caused the event
output - the output stream of the Template
sourceName - the name of the event source
severity - the severity of the message
Method Detail

getSourceName

public java.lang.String getSourceName()
Get the name of the source, such as freemarker.template.Template.process
Returns:
the name of the source

getSeverity

public int getSeverity()
Retrieve the severity, such as TemplateRuntimeHandler.SEVERITY_ERROR.
Returns:
the severity of the error

getOutput

public java.io.PrintWriter getOutput()
Deprecated. use the getWriter() method for maximum efficiency, since this method now has to wrap the underlying Writer in a PrintWriter object

Get the Template's current output stream. Used whenever we want to send messages to the template's output as a result of this event.
Returns:
the output stream of the Template

getWriter

public java.io.Writer getWriter()
Get the Template's current Writer. Used whenever we want to send messages to the template's output as a result of this event.
Returns:
the Writer for this Template

getException

public java.lang.Exception getException()
The exception that caused this event to be fired.
Returns:
the underlying exception