I'm working up an analysis model in UML, and I'm a bit stuck when trying to represent a constraint on a couple of attributes in a class diagram. In the following class:
+-----------+
| SomeClass |
+-----------+
| isFoo |
| isBar |
| isBaz |
| isQuux |
+-----------+
all the listed attributes are Boolean types, and the final two, isBaz
and isQuux
, are mutually exclusive. How do I indicate that? I'd rather not use an ad-hoc note -- more clutter.
Everything I can find about constraints in UML seems to apply them to associations, not attributes. I could break the attributes out into an associated class, but they're simple Boolean types, so something like this seems like overkill:
+-----------+
| SomeClass |
+-----------+ 0..1 isBaz 1 +-------------------+
| isFoo |------------------| ThereCanBeOnlyOne |
| isBar | | +-------------------+
| | |{NAND} | isBaz |
| |------------------| isQuux |
+-----------+ isQuux +-------------------+
What's the 'correct' way to model mutually exclusive attributes in UML?