JadeDynamicObject Class
The transient JadeDynamicObject class implements the structure and behavior of dynamic objects. A JADE dynamic object is a self-describing object whose attributes are determined at run time.
The JadeDynamicObject class has two fixed attributes: type and name, which you can use to determine the runtime type of a dynamic object. The JADE inspector displays the type, name, and dynamic attribute names and values of JadeDynamicObject instances.
If the type of a property is removed by deleting the class or removing the schema and the property has been assigned a value, the value is no longer valid and attempting to use it will raise exception 1046 (Invalid class number).
The method in the following example creates a dynamic object and passes this to the Collection class getStatistics method, which populates the object with various statistical attributes and their values, returning the dynamic object to the caller. The method then uses the getPropertyName, getPropertyValueByIndex, and propertyCount methods to display the statistical attribute name and value pairs. As the calling method created the jdo variable, it is also responsible for deletion, which is performed in an epilog.
vars jdo : JadeDynamicObject; str : String; int : Integer; count : Integer; begin create jdo; node.processes.getStatistics(jdo); str := '---' & jdo.getName & '(' & jdo.type.String & ')---'; count := jdo.propertyCount; foreach int in 1 to count do str := str & CrLf & jdo.getPropertyName(int) & " = " & jdo.getPropertyValueByIndex(int).String; endforeach; write str; epilog delete jdo; end;
The method in the following example uses the
getProcessTicks(); vars sample : JadeDynamicObject; cumulativeProcessTicks : Integer64; processTicks : Integer64; person : Person; begin create sample transient; process.getRequestStatistics(sample, 1); // local statistics cumulativeProcessTicks := sample.getPropertyValue("processTicks").Integer64; beginTransaction; create person persistent; person.surname := "Smith"; person.firstName := "John"; commitTransaction; process.getRequestStatistics(sample, 1); processTicks := sample.getPropertyValue("processTicks").Integer64 - cumulativeProcessTicks; delete sample; write "Process ticks to create an object = " & processTicks.String; end;
For details about the properties and methods defined in the JadeDynamicObject class, see "JadeDynamicObject Properties" and "JadeDynamicObject Methods", in the following subsections. For details about passing variable parameters to methods, see "
Object
(None)