如何使用 AttrBaseType 获取枚举属性

问题描述

我想使用 AttriBaseType 获取模块中的枚举属性并打印它的元素。

主要是想知道dxl中AttriBaseType的用法

解决方法

为了检索枚举值,如果你真的想显式使用它,你可以这样做:

AttrType at
for at in current Module do {
    print (at.name) " -- " (at.type) "\n"
    AttrBaseType abt = at.type
    if (abt == attrEnumeration) {
        print "it is an " abt "\n"
        int enumCount = at.size
        int index
        for (index = 0; index < enumCount; index++) {
            // value,related number
            print at.strings[index] "," at.values[index] "\n"
        }
        print "\n"
    }
}

相关问答

Selenium Web驱动程序和Java。元素在(x,y)点处不可单击。其...
Python-如何使用点“。” 访问字典成员?
Java 字符串是不可变的。到底是什么意思?
Java中的“ final”关键字如何工作?(我仍然可以修改对象。...
“loop:”在Java代码中。这是什么,为什么要编译?
java.lang.ClassNotFoundException:sun.jdbc.odbc.JdbcOdbc...