<< §5.4.1.(b) Method guards | ↑ Table of Contents ↑ | §5.4.1.(d) Team level guards >> |
§5.4.1.(c) Role level guards
When a guard is specified at the role level, i.e., directly before the class body of a role class, it applies to all callin method bindings of the role class:
protected class MyRole when (value > MyTeam.this.threshold) { int value; other class body declarations }
The following values are within the scope of the predicate expression:
- The role instance denoted by
this
(explicit or implicit, see above). Thus, in the examplevalue
will be interpreted as a field of the enclosing role. - The team instance denoted by a qualified this reference as in
MyTeam.this
<< §5.4.1.(b) Method guards | ↑ Table of Contents ↑ | §5.4.1.(d) Team level guards >> |