public class ReportInvalidReferences extends Object implements InvalidReferenceEventHandler, RuntimeServicesAware
Note that InvalidReferenceHandler can be used in two modes. If the Velocity properties file contains the following:
event_handler.invalid_references.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.
Modifier and Type | Field and Description |
---|---|
static String |
EVENTHANDLER_INVALIDREFERENCE_EXCEPTION |
static String |
OLD_EVENTHANDLER_INVALIDREFERENCE_EXCEPTION
Deprecated.
|
Constructor and Description |
---|
ReportInvalidReferences() |
Modifier and Type | Method and Description |
---|---|
List<InvalidReferenceInfo> |
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.
|
public static final String EVENTHANDLER_INVALIDREFERENCE_EXCEPTION
@Deprecated public static final String OLD_EVENTHANDLER_INVALIDREFERENCE_EXCEPTION
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 detailsParseErrorException
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 detailsParseErrorException
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, colpublic List<InvalidReferenceInfo> getInvalidReferences()
public void setRuntimeServices(RuntimeServices rs)
setRuntimeServices
in interface RuntimeServicesAware
rs
- RuntimeServices object assigned during initializationCopyright © 2000–2021 The Apache Software Foundation. All rights reserved.