Define a new data type
About this task
To define a new data type, create a .dti file named xxx.dti, with xxx as the name of the new data type. Data type names have no minimum or maximum allowable length. In this case, create a file named age.dti. To do this:
Procedure
-
Create a .dti file (data type declaration
file) to register the data type within Guidewire PolicyCenter. In Guidewire Studio,
do the following:
- In the Project tool window, navigate to .
- Right-click datatypes, and then click .
-
Enter the
name of the data type, followed by the .dti
extension.
For example, to create a data type named
Age, type age.dti.You must enter definitions for the following items for the data type. If necessary, view other samples of datatype definition files to determine what you need to enter.
- Name
- Value type
- Parameters
- Implementation type
-
Create a data type definition class
that implements the
gw.datatype.def.IDataTypeDefinterface. This class must include writable property definitions that correspond to each parameter that the data type accepts. -
Create data type handler classes
for each of the three aspects of the data type (constraints, persistence,
and presentation). These classes must implement the following interfaces:
gw.datatype.handler.IDataTypeConstraintsHandlergw.datatype.handler.IDataTypePersistenceHandlergw.datatype.handler.IDataTypePresentationHandler
Guidewire provides a number of implementations of these three interfaces for the standard data types. For example, you can create your own
CLOB-based data types by defining a data type that uses the ClobPersistenceHandler class. To access the handler interface implementations or to view a complete list, enter the following within Gosu code:gw.datatypes.impl.*
Results
After you create the data type, you will want to use the data type in some useful way.
Example
For example, you can create an entity property that uses that data type and then expose that property as a field within PolicyCenter.
