RoleConstraintsApi

Allows to add and check role constraints (Riehle constraints) to a compartment instance.

class Object
trait Matchable
class Any

Value members

Abstract methods

def addRoleEquivalence[A <: AnyRef : ClassTag, B <: AnyRef : ClassTag](): Unit

Adds an role equivalent constraint between the given role types. Interpretation: if a core object plays an instance of role type A it also has to play an instance of role type B and visa versa.

Adds an role equivalent constraint between the given role types. Interpretation: if a core object plays an instance of role type A it also has to play an instance of role type B and visa versa.

Type Params
A

type of role A that should be played implicitly if B is played

B

type of role B that should be played implicitly if A is played

def addRoleImplication[A <: AnyRef : ClassTag, B <: AnyRef : ClassTag](): Unit

Adds an role implication constraint between the given role types. Interpretation: if a core object plays an instance of role type A it also has to play an instance of role type B.

Adds an role implication constraint between the given role types. Interpretation: if a core object plays an instance of role type A it also has to play an instance of role type B.

Type Params
A

type of role A

B

type of role B that should be played implicitly if A is played

def addRoleProhibition[A <: AnyRef : ClassTag, B <: AnyRef : ClassTag](): Unit

Adds an role prohibition constraint between the given role types. Interpretation: if a core object plays an instance of role type A it is not allowed to play B as well.

Adds an role prohibition constraint between the given role types. Interpretation: if a core object plays an instance of role type A it is not allowed to play B as well.

Type Params
A

type of role A

B

type of role B that is not allowed to be played if A is played already

def checked(func: => Unit): Unit

Wrapping function that checks all available role constraints for all core objects and its roles after the given function was executed. Throws a RuntimeException if a role constraint is violated!

Wrapping function that checks all available role constraints for all core objects and its roles after the given function was executed. Throws a RuntimeException if a role constraint is violated!

Value Params
func

the function to execute and check role constraints afterwards