Re: [xwiki-users] Passing arguments to Groovy object constructor
Hi, On Tue, Dec 1, 2009 at 20:44, Rieken, Joshua joshua_rie...@reyrey.com wrote: Hello, Is it possible to pass arguments to a Groovy object instantiated using xwiki.parseGroovyFromPage(Blah.Blah), or is there some other way to do it? You could have some init() methods in your groovy class to call when you have the objects. Thanks, Joshua ___ users mailing list users@xwiki.org http://lists.xwiki.org/mailman/listinfo/users -- Thomas Mortagne ___ users mailing list users@xwiki.org http://lists.xwiki.org/mailman/listinfo/users
Re: [xwiki-users] Passing arguments to Groovy object constructor
On Dec 1, 2009, at 8:44 PM, Rieken, Joshua wrote: Hello, Is it possible to pass arguments to a Groovy object instantiated using xwiki.parseGroovyFromPage(Blah.Blah), or is there some other way to do it? BTW note that in XWiki Syntax 2.0 parseGroovyFromPage isn't needed. You can use the {{groovy}} and {{include}} macros instead. -Vincent ___ users mailing list users@xwiki.org http://lists.xwiki.org/mailman/listinfo/users
Re: [xwiki-users] Passing arguments to Groovy object constructor
-Original Message- From: users-boun...@xwiki.org [mailto:users-boun...@xwiki.org] On Behalf Of Thomas Mortagne Sent: Tuesday, December 01, 2009 2:39 PM To: XWiki Users Subject: Re: [xwiki-users] Passing arguments to Groovy object constructor Hi, On Tue, Dec 1, 2009 at 20:44, Rieken, Joshua joshua_rie...@reyrey.com wrote: Hello, Is it possible to pass arguments to a Groovy object instantiated using xwiki.parseGroovyFromPage(Blah.Blah), or is there some other way to do it? You could have some init() methods in your groovy class to call when you have the objects. Ah, yes, that will work for many uses. To be more specific, what I'm looking to do is create a class that extends groovy.io.File. A File does not have a constructor that takes zero arguments, so I was looking for a way to pass arguments when the object is created rather than calling an init(). Otherwise, I can't even instantiate the object without just hardcoding the path into the class, which is not a viable option. Any suggestions? Thanks, Joshua Thanks, Joshua ___ users mailing list users@xwiki.org http://lists.xwiki.org/mailman/listinfo/users -- Thomas Mortagne ___ users mailing list users@xwiki.org http://lists.xwiki.org/mailman/listinfo/users ___ users mailing list users@xwiki.org http://lists.xwiki.org/mailman/listinfo/users
Re: [xwiki-users] Passing arguments to Groovy object constructor
-Original Message- From: users-boun...@xwiki.org [mailto:users-boun...@xwiki.org] On Behalf Of Vincent Massol Sent: Tuesday, December 01, 2009 2:55 PM To: XWiki Users Subject: Re: [xwiki-users] Passing arguments to Groovy object constructor On Dec 1, 2009, at 8:44 PM, Rieken, Joshua wrote: Hello, Is it possible to pass arguments to a Groovy object instantiated using xwiki.parseGroovyFromPage(Blah.Blah), or is there some other way to do it? BTW note that in XWiki Syntax 2.0 parseGroovyFromPage isn't needed. You can use the {{groovy}} and {{include}} macros instead. -Vincent Thank you! This solved my issue. I was able to wrap the class in its own page with {{groovy}} {{/groovy}}, {{include}} that document, and create a new object with constructor arguments. -Joshua ___ users mailing list users@xwiki.org http://lists.xwiki.org/mailman/listinfo/users ___ users mailing list users@xwiki.org http://lists.xwiki.org/mailman/listinfo/users