Skip to main content
Jump to: navigation, search

OTExample ATM

Selectively applying roles to certain bases only

This is a simple example of an automatic teller machine (ATM). Using a known account it is possible to pay cash and to check the balance. Accounts of foreign banks are handled differently from home bank accounts. Additionally, it is possible to participate in special conditions to gain bonus for certain withdrawals.

The latter two requirements are used for demonstrating how roles can be applied selectively to only certain base objects. The desired effect is achieved by means of several guard predicates OTJLD §5.4.

  • The core classes define a simple plain Java model of a Bank with Accounts
  • Team class ATM features a role that applies to foreign accounts only
  • Team SpecialConditions defines the conditions of a bonus programme
  • There's also a simple Main class for running the example.

Back to the top