Method

Home > Metamodelling Concepts > Method

Methods and their signatures are a constitutive property of the object-oriented paradigm: they encapsulate the data and provide an interface to the programmer. Object orientation is OOMEGA's basic body of thought, consequently methods are supported and they can be used within your metamodels.

OOMEGA draws an important distinction between method signatures and method implementations. The signatures are not bound to a specific programming language i.e. can be defined in a programming language neutral way whereas the implementations are written entirely in the target language, currently Java.

Methods cannot be used within database queries - in contrast to inferred fields.

In SDL methods are represented as Java methods. There are no special annotations necessary.

Please notice that method signatures always contain OOMEGA types whereas its implementation is pure Java. Within the implementation you can make use of automatically generated getter/setter methods.

Here's an example:

public Set<DataClass> getMappedSubClasses() {
    Set<DataClass> result = new HashSet<DataClass>();
    for (DataClass c : getTransitiveSubClasses()) {
        if (c.isJMapped()) {
            result.add(c);
        }
    }
    return result;
}

Next chapter: Constant

Enter labels to add to this page:
Please wait 
Looking for a label? Just start typing.