Retrieve an instance of C (create it if necessary).
Retrieve an instance of C (create it if necessary). There can be only one for the supplied T.
the instance for the C representation
C
Retrieve an instance of C if one exists for T.
Retrieve an instance of C if one exists for T.
the reference for which to access C.
Option[C]
Sets a pre-defined value to this StorageComponent.
Sets a pre-defined value to this StorageComponent.
the component key
the value to set
StorageComponent leverages Storage to provide a single instance of the StorageComponent instance for the specified instance (T). This allows an easy-to-use "has a" relationship for easy extensibility.
Simply create an object that mixes in this trait and the associated class (C) with a private constructor.
class Example private() {}
object Example extends StorageComponent[Example, String]
The above example allows tying an "Example" instance to a specific String.