Please ensure Javascript is enabled for purposes of website accessibility
Powered by Zoomin Software. For more details please contactZoomin

AVEVA™ XR Studio

Runtime::Reflection

  • Last UpdatedOct 07, 2026
  • 2 minute read

The Runtime::Reflection class allows runtime inspection and manipulation of XRS classes, methods, and their associated attributes. It enables dynamic discovery and execution of code elements, making it ideal for implementing plugin systems, testing frameworks, and metadata-driven architectures.

Code example

This is a code example for Runtime::Reflection:

// Enumerate all classes

list<string> classes = Runtime::Reflection.EnumerateClasses();

// Find classes with a specific attribute

list<string> testClasses = Runtime::Reflection.EnumerateClassesForAttribute("Test");

// Get methods for a specific class

list<string> methods = Runtime::Reflection.EnumerateMethodsForClass("MyClass");

// Execute a method by name

Runtime::Reflection.ExecuteSScriptMethod("MyObject.MyMethod(param1, param2)");

// Get attributes for a method

list<string> attrs = Runtime::Reflection.GetAttributesForMethod("MyObject.MyMethod");

// Get attribute parameters

dictionary<string,string> params = Runtime::Reflection.GetParametersForAttribute("MyClass.MyMethod", "Description");

// Get all methods with specific attribute

list<string> markedMethods = Runtime::Reflection.EnumerateMethodsForAttribute("TestMethod");

Methods

The following table shows the currently implemented methods.

Method

Return type

Parameters

Description

EnumerateClasses

list<string>

none

Returns a list of all user-defined class names (excludes system classes).

EnumerateClassesForAttribute

list<string>

string attributeName

Returns a list of class names that have the specified attribute.

EnumerateMethods

list<string>

none

Returns a list of all methods in the format "ClassName.MethodName".

EnumerateMethodsForClass

list<string>

string className

Returns a list of all methods for a specific class in the format "ClassName.MethodName"

EnumerateMethodsForAttribute

list<string>

string attributeName

Returns a list of all methods that have the specified attribute in the format "ClassName.MethodName"

EnumerateSScriptMethodsForAttribute

list<string>

string attributeName

Returns a list of all SScript methods (from ScriptClass or ScriptObject nodes) that have the specified attribute.

ExecuteSScriptMethod

varies

string methodPath

Executes a SScript method specified by "ObjectName.MethodName()" and returns its result.

GetParametersForAttribute

dictionary<string,string>

string name, string attributeName

Returns the parameters of an attribute for a class or method. The name can be "ClassName", "ClassName.MethodName", or "ObjectName.MethodName".

GetAttributesForMethod

list<string>

string methodName

Returns a list of all attributes applied to a specific SScript method.

GetAttributesForClass

list<string>

string className

Returns a list of all attributes applied to a specific class.

In This Topic
Related Links