Calling a Jade method from a 'Method' object

Forums for specific tips, techniques and example code
User avatar
rolly
Posts: 11
Joined: Mon Aug 17, 2009 9:08 am

Calling a Jade method from a 'Method' object

Postby rolly » Tue Jul 03, 2012 11:38 am

I have reason to call a jade method on an object when all I have is the name of a method in a string form (I am using Jade 6.3)

Now I know I can get a reference to a Method object by doing a 'method := object.class.getMethodInHTree("methodName");
And I know I can also use the Async Method framework to call a method I know the name of, but the framework seems to be overkill for what I need.
So is a way for me to call the method directly?
As an aside, I am struggling to find info about the 'Method' object in the Jade documention too, so is it there but I am just missing it, or is not there?

Thanks
Roland

torrie
Posts: 92
Joined: Fri Aug 14, 2009 11:24 am

Re: Calling a Jade method from a 'Method' object

Postby torrie » Tue Jul 03, 2012 12:00 pm

Take a look at the "sendMsg" method (defined on Object.) This (and the sendMsgWithParams, sendMsgWithIOParams) methods allow you to call any method on an object. For example:

Code: Select all

Customer.firstInstance.sendMsg( "recalculateBalance" );

User avatar
rolly
Posts: 11
Joined: Mon Aug 17, 2009 9:08 am

Re: Calling a Jade method from a 'Method' object

Postby rolly » Tue Jul 03, 2012 12:42 pm

Thanks Torrie, this was part of what I needed, and now you reminded me, the deep recesses of my mind tell me I did actually know this.
Now any ideas how I can derive information about method parameters from schema metadata or Method object?

torrie
Posts: 92
Joined: Fri Aug 14, 2009 11:24 am

Re: Calling a Jade method from a 'Method' object

Postby torrie » Tue Jul 03, 2012 1:10 pm

Method parameters are hidden in Jade. The following script will list a method's parameters in order. Should get you started for calling a method.

Code: Select all

vars oClass : Class; oMethod : Method; oParam : Parameter; begin oClass := currentSchema.getClass( VCContact.name ); oMethod := oClass.getMethod( VCContact::update.name ); foreach oParam in oMethod.getPropertyValue("parameters").ParameterColl do write oParam.name & Tab & oParam.type.name; endforeach;


Return to “Tips and Techniques”

Who is online

Users browsing this forum: No registered users and 8 guests

cron