Aion BRE supports class interfaces, called _Interfaces. An _Interface provides the means to specify a set of methods while deferring their implementation. _Interfaces are especially valuable when creating Aion libraries, because they provide a means to decouple the library from the domain application by avoiding the need to relate the libraries through inheritance. For a discussion, see the white paper "Why Pattern Matching over Interfaces", which is available at https://supportconnectw.ca.com/premium/aion/infodocs/white_papers/PMIntrfac.asp.
Release:
Component: AIONBRE
This technical note explains how to represent interfaces in UML using AllFusion Component Modeler so that they map to _Interfaces in Aion.
Specifying an Interface in UML
To represent an interface in a class diagram in AllFusion Component Modeler, select the Interface icon from palette (the Interface icon looks like a lollipop that has fallen onto its side) and drag it onto a class diagram.
NOTE: The interface model element is stereotyped <<interface>>. A stereotype is a UML extension mechanism. It designates that this modeling element has special semantics. <<Interface>>s have only an operations compartment; thus, they are the exact equivalent of _Interfaces in Aion.
Relating Interfaces to Classes in UML
A class implements an _Interface when it provides a concrete implementation for the methods defined by that _Interface. In Aion, you specify the _Interfaces that a class implements by specifying the name of the _Interface in the Interfaces box of the Properties tab of the Class Editor.
In UML, to relate the interface to a class that implements that interface, you must draw a realization abstraction dependency between the class and the interface. Select the Abstraction relationship from the palette and draw the relationship from the class to the interface. Choose the "Realization" stereotype from the pop-up menu that results when you connect the relationship to the target (the interface). Your diagram should appear.
At import time, the Aion XMI importer will insert "MyInterface" in the "Interfaces" list in the Aion class editor for MyClass. If you do not use the realization abstraction relationship between the class and the interface, the relationship will be ignored by the Aion XMI importer.
IMPORTANT NOTE: Your interface will contain operation specifications. It is necessary to specify those operations as methods of the implementing class in the UML model. Failure to do so will result in Invalids when the class is imported into Aion.
Modeling References to an Interface
Classes can also refer to (point to) _Interfaces. For example,
CallingClasscalledInterface is &MyInterface // the value of calledInterface may be an
// instance of any class that implements MyInterface.
This technique enables CallingClass to reference and call methods on instances of different classes just as long as those methods are defined as part of the MyInterface. The classes do not need to be related in a common hierarchy; thus, interfaces provide more flexibility than polymorphism.
To provide a class with a reference to an Interface, you may create a directed association from a class to the interface. Be sure to name the navigable association end.
When imported into Aion, this structure will create an attribute of CallingClass named calledInterface of type Pointer to MyInterface. For more information on associations see the Technical Note, "Using Associations in UML to Create Pointers in Aion" (15563).
However, if the element that points to the _Interface is a local variable or a bind var in Aion, a directed association will be too strong. You do not want to create an actual attribute within your Aion code for the reference. In UML, these latter kinds of relationships are typically represented only by a (non-specific) dependency (a dashed, directed line with unnamed ends). Unfortunately, such dependencies do not provide sufficient information in UML to be mapped to a programming construct in an Aion application. You may wish to show these dependencies in your UML model as documentation, but you must hard-code them into your Aion application. (You will also need to reconstruct them when you reimport your model into AllFusion Component Modeler from Aion.)