Language of an executable opaque behavior can be OCL 2.0, binary, BeanShell, Groovy, JavaScript, Jython, or StructuredExpression. Also, it must have the proper number of parameters with proper types.
How many parameters can an opaque behavior have?
The number of parameters an opaque behavior can have depends on the selected language of the opaque behavior body:
An OCL 2.0 expression must have a single parameter.
A binary expression must declare the exact number of parameters has the Java class, to which the expression body of the opaque behavior references.
Other script expressions, such as JavaScript or Groovy, can have as many parameters as you need.
Structured expression can have as many parameters as you need.
How to create a parameter for the opaque behavior?
Specify the multiplicity of the parameter: either select a value from the drop-down list or type a new one.
Note
In this case, only the upper bound of the multiplicity is important. For example, the multiplicity [0..1] has the same meaning as the multiplicity [1].
Specify the type of the parameter: either select a value from the drop-down list or create a new one by typing directly in the cell.
Warning
Available types:
Built-in UML primitives (Integer, Real, String, and so forth)
UML element types
Java classes (java.io.File, java.util.Properties, and so forth)
If the multiplicity upper bound is 1, you may skip this step. Otherwise, specify the following:
Whether the arguments are unique.
Whether the arguments are ordered.
Note
If you do not see the Is Unique and Is Ordered properties, select All from the Properties drop-down list in the upper right of the Specification window.