org.apache.velocity.app.event
Class EventCartridge
java.lang.Object
org.apache.velocity.app.event.EventCartridge
- EventHandler, MethodExceptionEventHandler, NullSetEventHandler, ReferenceInsertionEventHandler
public class EventCartridge
extends java.lang.Object
'Package' of event handlers...
Version:
- Geir Magnusson Jr.
- Jose Alberto Fernandez
boolean | addEventHandler(EventHandler ev) - Adds an event handler(s) to the Cartridge.
|
boolean | attachToContext(Context context) - Attached the EventCartridge to the context
Final because not something one should mess with lightly :)
|
Object | methodException(Class claz, String method, Exception e) - Implementation of MethodExceptionEventHandler method
methodException() .
|
Object | referenceInsert(String reference, Object value) - Implementation of ReferenceInsertionEventHandler method
referenceInsert() .
|
boolean | removeEventHandler(EventHandler ev) - Removes an event handler(s) from the Cartridge.
|
boolean | shouldLogOnNullSet(String lhs, String rhs) - Implementation of NullSetEventHandler method
shouldLogOnNullSet() .
|
addEventHandler
public boolean addEventHandler(EventHandler ev)
Adds an event handler(s) to the Cartridge. This method
will find all possible event handler interfaces supported
by the passed in object.
ev
- object impementing a valid EventHandler-derived interface
- true if a supported interface, false otherwise or if null
attachToContext
public final boolean attachToContext(Context context)
Attached the EventCartridge to the context
Final because not something one should mess with lightly :)
context
- context to attach to
- true if successful, false otherwise
methodException
public Object methodException(Class claz,
String method,
Exception e)
throws Exception
Implementation of MethodExceptionEventHandler method
methodException()
.
Called during Velocity merge if a reference is null
- methodException in interface MethodExceptionEventHandler
claz
- Class that is causing the exceptionmethod
- method called that causes the exceptione
- Exception thrown by the method
- Object to return as method result
referenceInsert
public Object referenceInsert(String reference,
Object value)
Implementation of ReferenceInsertionEventHandler method
referenceInsert()
.
Called during Velocity merge before a reference value will
be inserted into the output stream.
- referenceInsert in interface ReferenceInsertionEventHandler
reference
- reference from template about to be insertedvalue
- value about to be inserted (after toString() )
- Object on which toString() should be called for output.
removeEventHandler
public boolean removeEventHandler(EventHandler ev)
Removes an event handler(s) from the Cartridge. This method
will find all possible event handler interfaces supported
by the passed in object and remove them.
ev
- object impementing a valid EventHandler-derived interface
- true if a supported interface, false otherwise or if null
shouldLogOnNullSet
public boolean shouldLogOnNullSet(String lhs,
String rhs)
Implementation of NullSetEventHandler method
shouldLogOnNullSet()
.
Called during Velocity merge to determine if when
a #set() results in a null assignment, a warning
is logged.
- shouldLogOnNullSet in interface NullSetEventHandler
- true if to be logged, false otherwise
Copyright © 2003 Apache Software Foundation. All Rights Reserved.