Functions using Engine classes as parameters

I have a bit of code in a global listener that I would like to move into a function, hidden in a temporary class (also in the listener). One of the parameters is of type Annotation, described in the Engine api. However the code fails on cannot resolve the annotation class.

Is there a special way to reference the Annotation type declaration?

I also tried

  import com.artisol.teneo.engine.core.inputprocessor.*

before the class but it did not help.

I’m setting up the class like this:

class Utility {

  public static anonymize(Annotation[] mAnnot, String[][] lWords, String sReplaceString) { ....

Many thanks for any tips!

Hi Fred!

The engine classes (including the IP API) are hidden from the script classloader to protect the engine from uncontrolled access from scripts. This is why the Groovy compiler cannot load the classes, but it can still access specific instances if they are supplied by the engine.

In your case it should be enough to declare the parameter mAnnot as Object []:

anonymize (Object [] mAnnot, String [] [] lWords, String sReplaceString)

Under no circumstances should the IP API jar be added to the script libs, as that would certainly lead to problems with class duplicates.

Hope this helps!

1 Like

Thank for the infos. Will try it this way then.

1 Like