Water 5-Type and Object System-Type SystemContract| Parameter key | Default value | Type | | comparator | "is_type_for" | string | | default_value | active_value | | ui | radio | auto_field | | Parameter kind | Default value | Type | | Other unkeyed arguments | opt | | Water Contract<class type.one_of
comparator ="is_type_for"
default_value=<active_value></active_value>
ui =biz.auto_field.radio
_other_unkeyed=opt=wob=ekind.code="_add_to_environment"
/> | |
Methods: typical_values, to_regex, is_type_for, random
one_of is the most commonly used type.
type.<one_of "red" "white" "blue"/>.<is_type_for "blue"/>
 | true |
type.<one_of "red" "white" "blue"/>.<is_type_for "pink"/>
 | false |
type.<one_of "red" "white" "blue"/>.<is_type_for "BLUE"/>
 | false |
type.<one_of "red" "white" "blue" same_case=false/>.
<is_type_for "BLUE"/> | true |
The opt parameters include_equal, include_instance, and
include_class provide precise control over matching.
The default settings let you treat objects created by class as
a 'class' For example:
<one_of number/>.<is_type_for 3/>
 | true |
<one_of number/>.<is_type_for integer/>
 | false |
<one_of number/>.<is_type_for number/>
 | false |
though non-classes in the type definition match other instances as in:
<one_of 3 5 7/>.<is_type_for 5/>
 | true |
Thus the default settings support the most common cases.
However, if you want to do something else, pick different values for
these settings. Say you want to write a type that includes
the integer and boolean objects but NOT actual integer instances
and not true & false.
type.<one_of integer boolean include_class=true
include_instance=false/>
Here's a list of possibilities:
| Use Cases: | include_equal | include_instance | include_class |
| exact match only | true | false | true |
| all below _subject but no _subject | false | true | true |
| all below _subject in _subject | true | true | true |
| only _subject excluding classes | true | false | false |
| all below _subject but not _subject excluding classes | false | true | false |
| all below _subject in _subject excluding classes (the default) | true | true | false |
| exclude everything | false | false | false |
type.<one_of string boolean/>.<is_type_for "blue"/>
 | true |
type.<one_of string boolean/>.<is_type_for false/>
 | true |
type.<one_of string boolean/>.<is_type_for string/>
 | false |
type.<one_of string boolean include_class=true/>.<is_type_for string/>
 | true |
type.<one_of string boolean include_class=true/>.<is_type_for "hi"/>
 | true |
type.<one_of string boolean include_equal=true include_instance=false/>.
<is_type_for "hi"/> | false |
Note that:
type.<one_of integer include_equal=true include_class=false/>.
<is_type_for integer/> | false |
because include_class over rules a include_equal setting of true.
© Copyright 2007 Clear Methods, Inc.