public class ReportInvalidReferences extends java.lang.Object implements InvalidReferenceEventHandler, RuntimeServicesAware
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.
InvalidReferenceEventHandler.InvalidGetMethodExecutor, InvalidReferenceEventHandler.InvalidMethodExecutor, InvalidReferenceEventHandler.InvalidSetMethodExecutor| 限定符和类型 | 字段和说明 |
|---|---|
static java.lang.String |
EVENTHANDLER_INVALIDREFERENCE_EXCEPTION |
| 构造器和说明 |
|---|
ReportInvalidReferences() |
| 限定符和类型 | 方法和说明 |
|---|---|
java.util.List |
getInvalidReferences()
All invalid references during the processing of this page.
|
java.lang.Object |
invalidGetMethod(Context context,
java.lang.String reference,
java.lang.Object object,
java.lang.String property,
Info info)
Collect the error and/or throw an exception, depending on configuration.
|
java.lang.Object |
invalidMethod(Context context,
java.lang.String reference,
java.lang.Object object,
java.lang.String method,
Info info)
Collect the error and/or throw an exception, depending on configuration.
|
boolean |
invalidSetMethod(Context context,
java.lang.String leftreference,
java.lang.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 java.lang.String EVENTHANDLER_INVALIDREFERENCE_EXCEPTION
public java.lang.Object invalidGetMethod(Context context, java.lang.String reference, java.lang.Object object, java.lang.String property, Info info)
invalidGetMethod 在接口中 InvalidReferenceEventHandlercontext - 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 detailsParseErrorExceptionpublic java.lang.Object invalidMethod(Context context, java.lang.String reference, java.lang.Object object, java.lang.String method, Info info)
invalidMethod 在接口中 InvalidReferenceEventHandlercontext - 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 detailsParseErrorExceptionpublic boolean invalidSetMethod(Context context, java.lang.String leftreference, java.lang.String rightreference, Info info)
invalidSetMethod 在接口中 InvalidReferenceEventHandlercontext - the context when the reference was found invalidleftreference - left reference being assigned torightreference - invalid reference on the rightinfo - contains info on template, line, colpublic java.util.List getInvalidReferences()
public void setRuntimeServices(RuntimeServices rs)
setRuntimeServices 在接口中 RuntimeServicesAwarers - RuntimeServices object assigned during initialization