JRuby, Groovy, Javascript, or Jython scripting language can be used to create a validation rule which are used to validate elements in your model. The advantage of using script validation rules is that it is not necessary to compile and store them in a classpath. Oftentimes, the code is compact and simple.
Here is an example validation rule written in JRuby:
if $THIS.isAbstract() return $THIS.getOwner().isAbstract() end true |
The rule validates operations in the model. If an operation is abstract, but its owning classifier isn't, the rule fails. "$THIS" variable references the element being validated. It should be used at least once in the code or in a comment.