Typekeys and typelists
Many Guidewire
entity data model entities contain properties that contain typekeys.
A typekey is similar to an enumeration. A typelist encapsulates a list
of typekeys. Each typekey has a unique immutable code as a String, in addition to a user-readable
(and localized) name. The code for a typekey is also known as a typecode.
For example, the typelist called AddressType contains typekey values
BUSINESS, HOME, and OTHER, which are available as constants
on the typelist type with some changes to the name.
Typelist Literals
In most cases, to
get a literal for a typelist, you can type the typelist name in the appropriate
programming context. Ambiguity about the name or package of the typelist
might occur in some programming contexts. To resolve this ambiguity,
type the fully qualified syntax typekey.TYPELISTNAME. For example,
typekey.AddressType.
Typecode Literals
To reference an existing typecode from Gosu, access the typecode by using the typelist name and
the typecode value in capital letters and the prefix TC_:
TYPELISTNAME.TC_TYPECODENAMEFor
example, to select from the AddressType
typelist a reference to the typekey with code BUSINESS, use:
AddressType.TC_BUSINESSIn the data model configuration, the typecode definition has an optional
identifierCode attribute, which changes how the application generates the programmatic
typekey name in Gosu. The value of the identifierCode attribute can include only characters
that are valid for a Gosu identifier such as a class or variable name. For example, you cannot include a hyphen
(-) character in the value of the identifierCode attribute. The maximum
length of the identifier code value is three characters fewer than the maximum length of a Gosu identifier name.
For practical purposes, this length is unlimited.
PolicyCenter uses the following rules to generate the typecode literal:
- If
the optional
identifierCodeattribute exists, PolicyCenter transforms theidentifierCodeattribute to upper case, and adds the prefixTC_. Using theidentifierCodeattribute ensures that all identifier names are unique, which prevents name conflicts among typecode literals. - If
the
identifierCodeattribute does not exist for a typecode, PolicyCenter generates the typecode literal from thecodeattribute. PolicyCenter transforms thecodeattribute to upper case, replaces invalid characters with underscores (_), and adds the prefixTC_. For example, codesabc,123, anda-bbecome the identifiersTC_ABC,TC_123, andTC_A_B, respectively. The substitution of invalid characters by underscores might cause two codes to become the same identifier. For example, codesA_BandA-Bboth becomeTC_A_B, which is a conflict that causes compilation errors.
