Discussion:
How to tell if a class has a method?
(too old to reply)
Adam
2008-02-08 15:42:00 UTC
Permalink
Hello,

If I want to check if a form has a method, I can call
Global::formHasMethod(...). Is there any similar method that I can call to
check if a class has a method?

Thanks,
Adam
unknown
2008-02-08 18:56:02 UTC
Permalink
Answer is:

static void Job1(Args _args)
{
SysDictClass dictClass = new SysDictClass(classNum(InventOnHand));
;
dictClass.hasObjectMethod(methodStr(InventOnHand, arrived));
dictClass.hasStaticMethod(staticmethodStr(InventOnHand, newItemDim));
}
--
Kashperuk Ivan (Vanya), Dynamics AX MCBMSS
My blog - http://kashperuk.blogspot.com
MorphX IT in Russian - http://www.lulu.com/content/723888
Post by Adam
Hello,
If I want to check if a form has a method, I can call
Global::formHasMethod(...). Is there any similar method that I can call to
check if a class has a method?
Thanks,
Adam
Adam
2008-02-11 15:06:07 UTC
Permalink
Perfect, thanks!
Post by unknown
static void Job1(Args _args)
{
SysDictClass dictClass = new SysDictClass(classNum(InventOnHand));
;
dictClass.hasObjectMethod(methodStr(InventOnHand, arrived));
dictClass.hasStaticMethod(staticmethodStr(InventOnHand, newItemDim));
}
--
Kashperuk Ivan (Vanya), Dynamics AX MCBMSS
My blog - http://kashperuk.blogspot.com
MorphX IT in Russian - http://www.lulu.com/content/723888
Post by Adam
Hello,
If I want to check if a form has a method, I can call
Global::formHasMethod(...). Is there any similar method that I can call to
check if a class has a method?
Thanks,
Adam
Rahul Shah
2008-02-17 07:08:02 UTC
Permalink
Hi Adam,

The code given by the kashperuk only checks for the methods which are
already exists in that class but if i want check for the method which is not
exist in the class then ?

can you let me know code for that ?
Post by unknown
static void Job1(Args _args)
{
SysDictClass dictClass = new SysDictClass(classNum(InventOnHand));
;
dictClass.hasObjectMethod(methodStr(InventOnHand, arrived));
dictClass.hasStaticMethod(staticmethodStr(InventOnHand, newItemDim));
}
--
Kashperuk Ivan (Vanya), Dynamics AX MCBMSS
My blog - http://kashperuk.blogspot.com
MorphX IT in Russian - http://www.lulu.com/content/723888
Post by Adam
Hello,
If I want to check if a form has a method, I can call
Global::formHasMethod(...). Is there any similar method that I can call to
check if a class has a method?
Thanks,
Adam
Marcin Krzyzanowski
2008-02-18 20:48:35 UTC
Permalink
Post by Rahul Shah
Hi Adam,
The code given by the kashperuk only checks for the methods which are
already exists in that class but if i want check for the method which is not
exist in the class then ?
You wan't check for method whoch doesn't exist ? then it doesn't exists
and you get false.

I think you asking about "how to check if *object instance* have a
method called ....". I don't know if it's possible to check if object
contains method created in runtime, but maybe.

unknown
2008-02-08 18:58:03 UTC
Permalink
you can use infolog.findNode()

Here's an exemple i use

*snip*
if (dsos.formRun())
{
treeNodePath = #WebFormsPath + '\\' + dsos.formRun().name()
+ '\\' + 'Data Sources' + '\\' + dsos.name() + '\\' + 'Methods' + '\\' +
'backColorHTML';
node = infolog.findNode(treeNodePath);
}
*snip*
--
Mathieu Vaillancourt
Post by Adam
Hello,
If I want to check if a form has a method, I can call
Global::formHasMethod(...). Is there any similar method that I can call to
check if a class has a method?
Thanks,
Adam
Adam
2008-02-11 15:08:00 UTC
Permalink
Thanks a lot for the suggestion, I'll try this method out too.
Post by unknown
you can use infolog.findNode()
Here's an exemple i use
*snip*
if (dsos.formRun())
{
treeNodePath = #WebFormsPath + '\\' + dsos.formRun().name()
+ '\\' + 'Data Sources' + '\\' + dsos.name() + '\\' + 'Methods' + '\\' +
'backColorHTML';
node = infolog.findNode(treeNodePath);
}
*snip*
--
Mathieu Vaillancourt
Post by Adam
Hello,
If I want to check if a form has a method, I can call
Global::formHasMethod(...). Is there any similar method that I can call to
check if a class has a method?
Thanks,
Adam
Loading...