Tuesday, January 14, 2014

Calling instance methods

static void callMethod(Args _args)
{
DictClass dictClass = new DictClass(classNum(ReleaseUpdateDB60_Cust));
Object classObj = dictClass.makeObject();
DictMethod dictMethod;
int i;
for (i=1; i < dictClass.objectMethodCnt(); i++)
{
if (Global::strStartsWith(dictClass.objectMethod(i), “update”))
{
dictClass.callObject(dictClass.objectMethod(i), classObj);
}
info(strFmt(“%1, %2, %3″, dictClass.objectMethodCnt(), dictClass.objectMethod(i), dictClass.name()));
}
}

or

Code to run all methods in a class through job

static void callMethod(Args _args)
{
DictClass dictClass = new DictClass(classNum(TestClass));
DictMethod dictMethod;
int i;
for (i=1; i < dictClass.staticMethodCnt(); i++)
{
if (Global::strStartsWith(dictClass.staticMethod(i), “create”))
{
dictClass.callStatic(dictClass.staticMethod(i));
}
info(strFmt(“%1, %2, %3″, dictClass.staticMethodCnt(), dictClass.staticMethod(i), dictClass.name()));
}
}

No comments: