Cameo Simulation Toolkit 2021x Refresh1 Documentation

You are viewing an old version of this page. View the current version.

Compare with Current View Page History

Version 1 Current »

You can use the following APIs to create a runtime object.
 

	public static Object_ createObject(Class classifier) {
		...
	} 
	
	public static Object_ createObject(String name) {
	...
	}

 

The following example shows how to create a runtime object (Object_), typed by a specified Classifier in ALH API.
If a passing parameter is typed by a String, the API will find a Class in the model that has a matching name, and then create the runtime object typed by that Class.

ALH.createObject("Car");

 

If an instance of the com.nomagic.uml2.ext.magicdraw.classes.mdkernel.Class has been passed on to the parameter "a", you can create an object through the specified Class directly as follows

ALH.createObject(a);

Note that if a parameter is equal to null, execution will be thrown.

 

  • No labels