Re: C2.2: Accessing static method on Java object with Flowscript

2011-08-14 Thread Andre Juffer
Ok, thanks. It is a bit counterintuitive. One would not expect that to be possible, but it works. On 15/08/11 08:23, Thomas Markus wrote: Hi, i missed the private i tried direct access and it works fine: var U = Packages.com.foo bar.UseFul; U.someMethod('text1', 'stringb'); Packages.com.foo

Re: C2.2: Accessing static method on Java object with Flowscript

2011-08-14 Thread Thomas Markus
Hi, i missed the private i tried direct access and it works fine: var U = Packages.com.foo bar.UseFul; U.someMethod('text1', 'stringb'); Packages.com.foo.bar.UseFul.someMethod('text1', 'stringb'); public class UseFul { private UseFul() {} public static void someMethod(String a, Str

Re: C2.2: Accessing static method on Java object with Flowscript

2011-08-14 Thread Andre Juffer
On 08/14/2011 03:04 PM, Thomas Markus wrote: Hi, or create an instance without spring: var bean = new com.foo.bar.Useful(); bean.someMethod(arg1, arg2); Actually, this would (should) not work as the constructor of Useful is private. It may be that this would not matter in flow, that is, one

Re: C2.2: Accessing static method on Java object with Flowscript

2011-08-14 Thread Thomas Markus
Hi, or create an instance without spring: var bean = new com.foo.bar.Useful(); bean.someMethod(arg1, arg2); regards Thomas Am 12.08.2011 15:34, schrieb Andre Juffer: To answer my own question. I created a new entry in the application's Spring configuration file, In script, I used var use

Re: C2.2: Accessing static method on Java object with Flowscript

2011-08-12 Thread Andre Juffer
To answer my own question. I created a new entry in the application's Spring configuration file, In script, I used var useful = cocoon.getComponent("com.foo.bar.Useful"); useful.someMethod(arg1, arg2); This does not require any modification to the source code of the class (that is, the priv

C2.2: Accessing static method on Java object with Flowscript

2011-08-12 Thread Andre Juffer
Hi, I am dealing with the following. An extremely useful Java class provides a static method for completing a particular task, like class Useful { private Useful() {} public static void someMethod(String arg1, String arg2) { ... } } In flow, I do something like var arg1 = "test1"