Skip to content

Java Integration (a.k.a. Class2MC)

When enabled (Gradle / CLI), Java types can be used within MontiArc models, just like user-defined types.

Special behavior of Java type usage in MontiArc

Note that calling constructors of object-oriented types in MontiArc obeys a special syntax:

compute {
  personOutPort = Person.Person("Steven");
}
When calling constructors, one calls the constructor as if it were a method of the defining type:
TypeName.methodName(/*arguments*/)
As the constructor method name is the same as the type name, this syntax becomes
TypeName.TypeName(/*arguments*/)