Using X++ Code export to methods list of Class

static void Jimmy_ClassMethodsExport()
{
/***
    wrote by Jimmy on DEV. 1th 2010
    SysDictClass :
        get AOT Class infomation
    TextBuffer :
        test wrote data to excel file.
    match:
        An expression followed by an asterisk requires a match for none, one,
    or more occurrences of the preceding expression.
*/
    SysDictClass        sysDictClass;
    Set                 setList;
    SetEnumerator       setEnum;
    str                 methodName;
    TextBuffer          text;
    #define.matchKeyword('g*')
;
    // Object Initialization
    sysDictClass     = new SysDictClass(classnum(Info));
    setList          = new Set(Types::String);
    text             = new TextBuffer();
  
    setList = sysDictClass.objectMethodSet(true);//true is include Inherited class's Methods,false only inlude current classs's methods
    setEnum = setList.getEnumerator();

    while (setEnum.moveNext())
    {
        if(match(#matchKeyword, setEnum.current())) // match p* prefix methods
        {
            //methodName = strrem(setEnum.current(), '["]');
            methodName = setEnum.current();
            text.appendText(methodName + '\n');
        }
    }
    if(WinAPI::fileExists(@'C:\MethodNames.xls'))
        WINAPI::deleteFile(@'C:\MethodNames.xls');
        
    text.toFile(@'C:\MethodNames.xls', FileEncoding::UTF8);

}

posted @ 2010-12-01 15:11  Fandy Xie  Views(223)  Comments(0Edit  收藏  举报