Dynamic Objects
The
The JadeDynamicObject class has two fixed attributes:
In the following example, a dynamic object is created and the three properties called Item, Quantity, and Available are added and their values are set. At the end of the method, the names and values of the properties are displayed.
vars
jdo : JadeDynamicObject;
i : Integer;
str : String;
begin
create jdo;
jdo.addProperty("Item", String);
jdo.setPropertyValue("Item", "calculator");
jdo.addProperty("Quantity", Integer);
jdo.setPropertyValue("Quantity", 100);
jdo.addProperty("Available", Boolean);
jdo.setPropertyValue("Available", true);
foreach i in 1 to jdo.propertyCount do
str := str & CrLf & jdo.getPropertyName(i) & " = "
& jdo.getPropertyValueByIndex(i).String;
endforeach;
write str;
epilog
delete jdo;
end;
The output from the previous method is as follows.
Item = calculator Quantity = 100 Available = true
The method in the following example creates a dynamic object and passes this to the
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;
For details about the properties and methods defined in the
