↑ Table of Contents ↑ | §7.2 Confined roles >> |
§7.1 Opaque roles
The purpose of the two IConfined
interfaces (see §6.2.(a)) is to define
opaque roles: Any role implementing IConfined
can be externalized using this type, such that external clients
cannot access any features of the role. The type IConfined
exposes no features and references of this type cannot be widened
to any type not even to java.lang.Object
.
If the actual role type is furthermore invisible outside the team
(by not declaring it public
), it is perfectly safe to externalize
such roles using type IConfined
(which is a public interface)
and pass them back to the owning team. The encapsulation
of the team is in no way breached by externalizing opaque roles,
which can only be used as a handle into internal state of the team.
The difference between the two mentioned interfaces is that
ITeam.IConfined
requires to use this type or any subtype
as externalized role. Such a reference contains the information of
the enclosing team. Even stricter control can be imposed using the
regular interface IConfined
. Here not even team membership
is visible to clients using a reference of this type.
↑ Table of Contents ↑ | §7.2 Confined roles >> |