Custom OCL Functions


General functions (available on any type)

Name Parameters Return type Description Example
+ any object String returns the string concatenation of the two object (after having converted them to string) myVar + anotherVar + 'a string' + 1234
newColor red (integer), green (integer), blue (integer) java.awt.Color returns a new color (which is helpful with DynamicPropertyOverriders) newColor(200, 225, 250)
hexToColor a string giving the color in hex mode (HTML mode) java.awt.Color returns a new color (which is helpful with DynamicPropertyOverriders) newColor(200, 225, 250)


String functions

Name Parameters Return type Description Example
startsWith a string (String type) Boolean returns true if the string to which is applied the function starts with the specified string myVar.startsWith('a string')
endsWith a string (String type) Boolean returns true if the string to which is applied the function ends with the specified string myVar.endsWith('a string')
matches a regular expression (String type) Boolean returns true if the string to which is applied the function matches the specified regular expression myVar.matches('[a-zA-Z0-9]+')
contains a string (String type) Boolean returns true if the string to which is applied the function contains the specified string myVar.contains('a string')
split the separators (String type) Collection<String> Splits the string according to the specified separator list myVar.split(',;:')


Collection functions

Name Parameters Return type Description Example
toString - String returns a string represenation of the collection myCollection.toString()


EOperation functions

Name Parameters Return type Description Example
toEcoreDiagString - String converts an EOperation to a string (this function is used in the Ecore diagram generation feature) myEOperation.toEcoreDiagString()