freemarker.template
Class SimpleEventAdapter

java.lang.Object
  |
  +--freemarker.template.SimpleEventAdapter
All Implemented Interfaces:
TemplateRuntimeHandler

public final class SimpleEventAdapter
extends java.lang.Object
implements TemplateRuntimeHandler

Adapter class for firing events that could happen at Template runtime. At most one listener can be registered for different events that can occur. This event adapter is an immutable class so that singleton instances can't have their behaviour changed.

Since:
1.8
Version:
$Id: SimpleEventAdapter.java,v 1.2 2003/11/24 05:49:49 run2000 Exp $
See Also:
TemplateEventAdapter

Fields inherited from interface freemarker.template.TemplateRuntimeHandler
SEVERITY_DEPRECATION, SEVERITY_ERROR, SEVERITY_WARNING
 
Constructor Summary
SimpleEventAdapter()
          Creates a new SimpleEventAdapter.
SimpleEventAdapter(TemplateExceptionListener exceptionListener)
          Creates a new SimpleEventAdapter with the given exception listener as the target of the exception events generated.
 
Method Summary
 void fireExceptionThrown(java.lang.Object source, java.lang.Exception exception, java.io.Writer output, java.lang.String sourceName, int severity)
          Fires a TemplateExceptionEvent to the current listener.
 java.lang.String toString()
          Returns a string representation of the object.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

SimpleEventAdapter

public SimpleEventAdapter()
Creates a new SimpleEventAdapter.

SimpleEventAdapter

public SimpleEventAdapter(TemplateExceptionListener exceptionListener)
Creates a new SimpleEventAdapter with the given exception listener as the target of the exception events generated.
Parameters:
exceptionListener - the single event listener to received exception events
Method Detail

fireExceptionThrown

public void fireExceptionThrown(java.lang.Object source,
                                java.lang.Exception exception,
                                java.io.Writer output,
                                java.lang.String sourceName,
                                int severity)
Fires a TemplateExceptionEvent to the current listener.
Specified by:
fireExceptionThrown in interface TemplateRuntimeHandler
Parameters:
source - the source object of the event
exception - the exception that caused the event to be fired
output - the current Template output stream
sourceName - the name of the source class and method that fired the event
severity - the severity of the exception

toString

public java.lang.String toString()
Returns a string representation of the object.
Overrides:
toString in class java.lang.Object
Returns:
a string representation of the object.