§2.2.(d) Explicit lowering

If a base type is also the super type of its role, which frequently happens, if a base reference is known only by the type Object, lowering cannot be deduced automatically, since a type could be interpreted both as a role type and a base type. These cases may need explicit lowering. For this purpose the role class must declare to implement the interface ILowerable (from org.objectteams.ITeam). This will cause the compiler to generate a method

public Object lower()

for the given role class. Client code may use this method to explicitly request the base object of a given role object.

1
public team class MyTeamA {
2
  public class MyRole implements ILowerable playedBy MyBase { ... }
3
  public void doSomething() {
4
    MyRole r = new MyRole(new MyBase());
5
    Object oMyRole = r;
6
    Object oMyBase = r.lower();
7
  }
8
}