Java scripts

You can write scripts in Java. These scripts are executed exactly like TGL or MQL scripts, and may call any other existing script regardless of their implementation language.

Scripts are defined in a Java class that extends the class ScriptContainer. For example, a script attached to the UML Class metatype would be defined in a subclass of com.sodius.mdw.metamodel.uml21.scripts.ClassScriptContainer.

package com.mycompany.example;

import com.sodius.mdw.metamodel.uml21.scripts.ClassScriptContainer;

public class uml21_Class extends ClassScriptContainer {

    // Defines a qualifiedName script attached to a UML Class
    public String qualifiedName() {
        return self.getNamespace().toString("qualifiedName") + "." + self.getName();
    }
}

You can access the instance the script is evaluated on using the self variable.

Each method defined in a subclass of ScriptContainer is considered as a script.

Related concepts
Script