canAccessStatement

canAccessStatement(statement:    String;
                   errorMessage: String output): Boolean;

The canAccessStatement method of the JadeMetadataAnalyzer class is called by the validateMethod method to check the access to each statement referenced in the method being validated. The name of the statement is specified in the statement parameter. Class constants define the names of statements that can be checked. (For details, see "JadeMetadataAnalyzer Class Constants", earlier in this chapter.)

The canAccessStatement method returns true if the access is allowed or it returns false if the access is not allowed.

If the access is not allowed, an error message may be returned in the errorMessage parameter and this message is then returned in the accessErrorMessage parameter of the validateMethod method. The canAccessStatement method returns true by default.

To implement user-defined access checking of statements, reimplement this method in a user subclass of the JadeMetadataAnalyzer class. The following example shows the canAccessStatement method reimplemented in a subclass of the JadeMetadataAnalyzer class to check that input method source code does not reference the beginTransaction instruction.

canAccessStatement(statement: String; errorMessage: String output): Boolean;
begin
    if statement = Statement_BeginTransaction then
        errorMessage := 'transactions are not allowed';
        return false;
    endif;
    return true;
end;