How to model dependency injection in UML ?
- by hjo1620
I have a Contract class. The contract is valid 1 Jan 2010 - 31 Dec 2010.
It can be in state Active or Passive, depending on which date I ask the instance for it's state. ex. if I ask 4 July 2010, it's in state Active, but if I ask 1 Jan 2011, it's in state Passive.
Instances are created using constructor dependency injection, i.e. they are either Active or Passive already when created, null is not allowed as a parameter for the internal state member.
One initial/created vertex is drawn in UML.
I have two arrows, leading out from the initial vertex, one leading to state Active and the other to state Passive.
Is this a correct representation of dependency injection in UML ?
This is related to
http://stackoverflow.com/questions/2779922/how-model-statemachine-when-state-is-dependent-on-a-function
which initiated the question on how to model DI in general, in UML.