从 Peoplecode 中的字符串动态创建对象

Create object dynamically from string in Peoplecode

我在一个 Peoplesoft 项目上工作,我正在努力使用 Peoplecode。 我想在 Peoplecode 中创建一个具有动态类名的对象。有点像 Java。这看起来像这样:

&my_object = create My_Application_Package : Class_string_name()
&my_object.commonMethodCall();

其中“Class_string_name”是动态的。这可能吗 ? 我是否必须为所有相关 类 创建一个界面?

欢迎任何帮助或建议

谢谢

最后还是挺简单的

我刚刚使用了 CreateObject 函数:

CreateObject(str_class_name, create_par, . . .)

Where str_class_name either:

—identifies a class by class name

—identifies a class of OLE Automation object in the form:

app_name.object_name

Description

Use the CreateObject function to return an instance of a class. You can use this function to access an Application Class, a PeopleCode built-in object (like a chart), or an OLE Automation object.

If the class you are creating requires values to be passed, use the create_par parameters to supply them, or use the CreateObjectArray function.

Considerations Using Application Classes

You can use the CreateObject function to access an Application Class. You would want to do this when you were programming at a high-level, when you might not know the name of the class you wanted to access until runtime. You must specify a fully-qualified class name. In addition, the class name is case-sensitive.

The returned object has the type of class you specified.