|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object org.apache.velocity.app.event.implement.ReportInvalidReferences
public class ReportInvalidReferences
Use this event handler to flag invalid references. Since this is intended to be used for a specific request, this should be used as a local event handler attached to a specific context instead of being globally defined in the Velocity properties file.
Note that InvalidReferenceHandler can be used in two modes. If the Velocity properties file contains the following:
eventhandler.invalidreference.exception = truethen the event handler will throw a ParseErrorRuntimeException upon hitting the first invalid reference. This stops processing and is passed through to the application code. The ParseErrorRuntimeException contain information about the template name, line number, column number, and invalid reference.
If this configuration setting is false or omitted then the page will be processed as normal, but all invalid references will be collected in a List of InvalidReferenceInfo objects.
This feature should be regarded as experimental.
Nested Class Summary |
---|
Nested classes/interfaces inherited from interface org.apache.velocity.app.event.InvalidReferenceEventHandler |
---|
InvalidReferenceEventHandler.InvalidGetMethodExecutor, InvalidReferenceEventHandler.InvalidMethodExecutor, InvalidReferenceEventHandler.InvalidSetMethodExecutor |
Field Summary | |
---|---|
static String |
EVENTHANDLER_INVALIDREFERENCE_EXCEPTION
|
Constructor Summary | |
---|---|
ReportInvalidReferences()
|
Method Summary | |
---|---|
List |
getInvalidReferences()
All invalid references during the processing of this page. |
Object |
invalidGetMethod(Context context,
String reference,
Object object,
String property,
Info info)
Collect the error and/or throw an exception, depending on configuration. |
Object |
invalidMethod(Context context,
String reference,
Object object,
String method,
Info info)
Collect the error and/or throw an exception, depending on configuration. |
boolean |
invalidSetMethod(Context context,
String leftreference,
String rightreference,
Info info)
Collect the error and/or throw an exception, depending on configuration. |
void |
setRuntimeServices(RuntimeServices rs)
Called automatically when event cartridge is initialized. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
public static final String EVENTHANDLER_INVALIDREFERENCE_EXCEPTION
Constructor Detail |
---|
public ReportInvalidReferences()
Method Detail |
---|
public Object invalidGetMethod(Context context, String reference, Object object, String property, Info info)
invalidGetMethod
in interface InvalidReferenceEventHandler
context
- the context when the reference was found invalidreference
- string with complete invalid referenceobject
- the object referred to, or null if not foundproperty
- the property name from the referenceinfo
- contains template, line, column details
ParseErrorException
public Object invalidMethod(Context context, String reference, Object object, String method, Info info)
invalidMethod
in interface InvalidReferenceEventHandler
context
- the context when the reference was found invalidreference
- complete invalid referenceobject
- the object referred to, or null if not foundmethod
- the property name from the referenceinfo
- contains template, line, column details
ParseErrorException
public boolean invalidSetMethod(Context context, String leftreference, String rightreference, Info info)
invalidSetMethod
in interface InvalidReferenceEventHandler
context
- the context when the reference was found invalidleftreference
- left reference being assigned torightreference
- invalid reference on the rightinfo
- contains info on template, line, col
public List getInvalidReferences()
public void setRuntimeServices(RuntimeServices rs)
setRuntimeServices
in interface RuntimeServicesAware
rs
- RuntimeServices object assigned during initialization
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |