Interval Constraints
Let’s learn about interval constraints.
We'll cover the following
An interval constraint requires that an attribute’s value must be in a specific interval, which is specified by a minimum value, a maximum value, or both. Such a constraint can be defined for any attribute that has an ordered type, but normally we define them only for numeric datatypes or calendar datatypes. For instance, we may want to define an interval constraint that requires the age
attribute value must be in the interval [25,70].
Interval constraints in UML
In a class diagram, we can define such a constraint by using the property modifiers min
and max
, as shown for the age attribute of the Driver
class in the following diagram.
Get hands-on with 1400+ tech skills courses.