枚举属性可以定义为具有有效值列表:例如
text
日期
地址
电话
还有两个默认值
无效的默认值,例如电话
缺失值默认值:例如文本
然后对于上面的元素foo和属性bar:
=> valid value, state is `date`
=> invalid value, state is the invalid default `phone`
=> missing value, state is the missing value default `text`
但有时,该属性没有为其定义无效的默认值,但它确实缺少默认值。在这种情况下:
=> valid value, state is `date`
=> invalid value, state is the missing value default `text`
=> missing value, state is the missing value default `text`
有时,该属性具有为其定义的无效默认值,但它没有默认定义的缺失值。在这种情况下:
=> valid value, state is `date`
=> invalid value, state is the invalid default `phone`
=> missing value, attribute has no state
有时,该属性没有为其定义无效默认值或缺省值。在这种情况下:
=> valid value, state is `date`
=> invalid value, attribute has no state
=> missing value, attribute has no state