Script call

Call methods

Scripts are called using APIs defined on the interface com.sodius.mdw.core.model.MDWObject, root of metatypes:

Additional script call methods are provided to convert the evaluation result to a specific type.
Here are the most commonly used:

Call arguments

When the script defines parameters, you have to give arguments using a java.util.List.

The class ScriptContainer, root of Java classes where scripts are defined, provides some facilities to build an argument list:


package com.mycompany.example;

import com.sodius.mdw.core.model.MDWList;
import com.sodius.mdw.metamodel.uml21.scripts.ClassScriptContainer;

public class uml21_Class extends ClassScriptContainer {

    public String qualifiedName() {
        // Calls 'qualifiedName' defined on the namespace
        return self.getNamespace().toString("qualifiedName") + "." + self.getName();
    public MDWList callWithArgs(Object value) {
        // Uses asList() to provide script arguments
        return self.toList("myScript", asList("Hello", Boolean.TRUE, value));