|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object freemarker.template.SimpleEventAdapter
public final class SimpleEventAdapter
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.
Usage example:
// Configure Log4j ... // Set up the template Template template = new Template(filename); // Set up the model TemplateModelRoot modelRoot = (...) // Set up the listener SimpleEventAdapter adapter = new SimpleEventAdapter( new Log4jExceptionListener() ); // Call the template template.process( modelRoot, writer, adapter );
TemplateEventAdapter
Nested Class Summary |
---|
Nested classes/interfaces inherited from interface freemarker.template.TemplateRuntimeHandler |
---|
TemplateRuntimeHandler.Severity |
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,
TemplateRuntimeHandler.Severity 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 |
---|
public SimpleEventAdapter()
public SimpleEventAdapter(TemplateExceptionListener exceptionListener)
exceptionListener
- the single event listener to received
exception eventsMethod Detail |
---|
public void fireExceptionThrown(java.lang.Object source, java.lang.Exception exception, java.io.Writer output, java.lang.String sourceName, TemplateRuntimeHandler.Severity severity)
TemplateExceptionEvent
to the current listener.
fireExceptionThrown
in interface TemplateRuntimeHandler
source
- the source object of the eventexception
- the exception that caused the event to be firedoutput
- the current Template output streamsourceName
- the name of the source class and method that fired
the eventseverity
- the severity of the exceptionpublic java.lang.String toString()
toString
in class java.lang.Object
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |