Class ReportInvalidReferences
- java.lang.Object
- 
- org.apache.velocity.app.event.implement.ReportInvalidReferences
 
- 
- All Implemented Interfaces:
- EventHandler,- InvalidReferenceEventHandler,- RuntimeServicesAware
 
 public class ReportInvalidReferences extends Object implements InvalidReferenceEventHandler, RuntimeServicesAware 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: event_handler.invalid_references.exception = true then 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. - Since:
- 1.5
- Version:
- $Id$
- Author:
- Will Glass-Husain
 
- 
- 
Field SummaryFields Modifier and Type Field Description static StringEVENTHANDLER_INVALIDREFERENCE_EXCEPTIONstatic StringOLD_EVENTHANDLER_INVALIDREFERENCE_EXCEPTIONDeprecated.
 - 
Constructor SummaryConstructors Constructor Description ReportInvalidReferences()
 - 
Method SummaryAll Methods Instance Methods Concrete Methods Modifier and Type Method Description List<InvalidReferenceInfo>getInvalidReferences()All invalid references during the processing of this page.ObjectinvalidGetMethod(Context context, String reference, Object object, String property, Info info)Collect the error and/or throw an exception, depending on configuration.ObjectinvalidMethod(Context context, String reference, Object object, String method, Info info)Collect the error and/or throw an exception, depending on configuration.booleaninvalidSetMethod(Context context, String leftreference, String rightreference, Info info)Collect the error and/or throw an exception, depending on configuration.voidsetRuntimeServices(RuntimeServices rs)Called automatically when event cartridge is initialized.
 
- 
- 
- 
Field Detail- 
EVENTHANDLER_INVALIDREFERENCE_EXCEPTIONpublic static final String EVENTHANDLER_INVALIDREFERENCE_EXCEPTION - See Also:
- Constant Field Values
 
 - 
OLD_EVENTHANDLER_INVALIDREFERENCE_EXCEPTION@Deprecated public static final String OLD_EVENTHANDLER_INVALIDREFERENCE_EXCEPTION Deprecated.- See Also:
- Constant Field Values
 
 
- 
 - 
Method Detail- 
invalidGetMethodpublic Object invalidGetMethod(Context context, String reference, Object object, String property, Info info) Collect the error and/or throw an exception, depending on configuration.- Specified by:
- invalidGetMethodin interface- InvalidReferenceEventHandler
- Parameters:
- context- the context when the reference was found invalid
- reference- string with complete invalid reference
- object- the object referred to, or null if not found
- property- the property name from the reference
- info- contains template, line, column details
- Returns:
- always returns null
- Throws:
- ParseErrorException
 
 - 
invalidMethodpublic Object invalidMethod(Context context, String reference, Object object, String method, Info info) Collect the error and/or throw an exception, depending on configuration.- Specified by:
- invalidMethodin interface- InvalidReferenceEventHandler
- Parameters:
- context- the context when the reference was found invalid
- reference- complete invalid reference
- object- the object referred to, or null if not found
- method- the property name from the reference
- info- contains template, line, column details
- Returns:
- always returns null
- Throws:
- ParseErrorException
 
 - 
invalidSetMethodpublic boolean invalidSetMethod(Context context, String leftreference, String rightreference, Info info) Collect the error and/or throw an exception, depending on configuration.- Specified by:
- invalidSetMethodin interface- InvalidReferenceEventHandler
- Parameters:
- context- the context when the reference was found invalid
- leftreference- left reference being assigned to
- rightreference- invalid reference on the right
- info- contains info on template, line, col
- Returns:
- loop to end -- always returns false
 
 - 
getInvalidReferencespublic List<InvalidReferenceInfo> getInvalidReferences() All invalid references during the processing of this page.- Returns:
- a List of InvalidReferenceInfo objects
 
 - 
setRuntimeServicespublic void setRuntimeServices(RuntimeServices rs) Called automatically when event cartridge is initialized.- Specified by:
- setRuntimeServicesin interface- RuntimeServicesAware
- Parameters:
- rs- RuntimeServices object assigned during initialization
 
 
- 
 
-