Search code examples
javatibcobusinessworks

(TIBCO BusinessWorks) How do you access a Java Global Instance method from a Java Code activity?


The TIBCO ActiveMatrix BusinessWorks Palette Reference states:

"Any Java Code activity can access the shared Java Global Instance by invoking the static methods of the configured Java class", however, I've been unable to locate any code examples for doing this, or figure out the correct syntax on my own.

What doesn't work:

method();
Class.method();

What does work:

I dunno, that's why I'm here :)


Solution

  • If you have the following class referenced in an AliasLibrary:

    com.example.foo.Foo

    and it has a static method bar(), then you can call that in a Java Code activity by simply using:

    com.example.foo.Foo.bar();

    in your Java Code activity. Make sure you reference AliasLibrary in the Java Code configuration panel.

    You can do this without using a Java Global Instance. Which is what you'd expect that for a static method....you shouldn't need an object reference.