Class GroovyCheckTransformation

java.lang.Object
org.codehaus.groovy.transform.AbstractASTTransformation
com.axelor.script.GroovyCheckTransformation
All Implemented Interfaces:
org.codehaus.groovy.transform.ASTTransformation, org.codehaus.groovy.transform.ErrorCollecting

public class GroovyCheckTransformation extends org.codehaus.groovy.transform.AbstractASTTransformation
A custom groovy ast transformer to validate type of objects against the policy settings.

This transformer will transform the ctor/method/property calls by wrapping the object side in `__$$check(Object)` helper.

It will also transform loop and if blocks and adds timeout check.

For example:

 def value = some.method()

 while(true) {
   println('Hello')
 }
 
would become:
 def value = __$$policy.check(some).method()

 while(true) {
   __$$policy.timeout()
   __$$policy.check(this).println('Hello')
 }
 
  • Field Summary

    Fields inherited from class org.codehaus.groovy.transform.AbstractASTTransformation

    RETENTION_CLASSNODE, sourceUnit
  • Constructor Summary

    Constructors
    Constructor
    Description
     
  • Method Summary

    Modifier and Type
    Method
    Description
    void
    visit(org.codehaus.groovy.ast.ASTNode[] nodes, org.codehaus.groovy.control.SourceUnit source)
     

    Methods inherited from class org.codehaus.groovy.transform.AbstractASTTransformation

    addError, checkIncludeExcludeUndefinedAware, checkIncludeExcludeUndefinedAware, checkNotInterface, checkPropertyList, checkPropertyList, checkPropertyList, copyAnnotatedNodeAnnotations, copyAnnotatedNodeAnnotations, deemedInternalName, getAnnotationName, getMemberClassList, getMemberClassValue, getMemberClassValue, getMemberIntValue, getMemberStringList, getMemberStringValue, getMemberStringValue, getMemberValue, hasAnnotation, init, memberHasValue, shouldSkip, shouldSkip, shouldSkipOnDescriptorUndefinedAware, shouldSkipUndefinedAware, shouldSkipUndefinedAware, tokenize

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Constructor Details

    • GroovyCheckTransformation

      public GroovyCheckTransformation()
  • Method Details

    • visit

      public void visit(org.codehaus.groovy.ast.ASTNode[] nodes, org.codehaus.groovy.control.SourceUnit source)