freemarker.template
Class TemplateExceptionEvent

java.lang.Object
  extended by java.util.EventObject
      extended by 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: TemplateExceptionEvent.java 1101 2013-04-01 04:17:32Z run2000 $
See Also:
TemplateExceptionListener, TemplateRuntimeHandler, Serialized Form

Field Summary
 
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, TemplateRuntimeHandler.Severity 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
 TemplateRuntimeHandler.Severity 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,
                              TemplateRuntimeHandler.Severity 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 TemplateRuntimeHandler.Severity getSeverity()
Retrieve the severity, such as TemplateRuntimeHandler.Severity.ERROR.

Returns:
the severity of the error

getOutput

@Deprecated
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