クラスに定義されたプロパティの情報については、以下システムクラスを利用して情報を取得できます。
%Dictionary.ClassDefinetion
%Dictionary.PropertyDefinition
ルーチン記述例は以下の通りです。(ルーチン名=^ClassInfo)
// プロパティ情報取得
// 第1引数は調査対象のクラス名(パッケージ名.クラス名)
getPropInfo(classname) //
set cls=##class(%Dictionary.ClassDefinition).%OpenId(classname)
set x=cls.Properties
for i=1:1:x.Count() {
// プロパティ情報を取得(%Dictionary.PropertyDefinition)
set prop=x.GetAt(i)
if prop="" continue
set propname=prop.Name // プロパティ名
set proptype=prop.Type // プロパティタイプ
if propname="" continue
write propname," ",proptype,!
}
quit
ルーチン実行は、以下の通りです。
USER>do getPropInfo^ClassInfo("User.Person")
Age %Integer
Name %String