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

  1. Create a .dti file (data type declaration file) to register the data type within Guidewire PolicyCenter. In Guidewire Studio, do the following:
    1. In the Project tool window, navigate to configuration > config > datatypes.
    2. Right-click datatypes, and then click New > File.
    3. 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
  2. Create a data type definition class that implements the gw.datatype.def.IDataTypeDef interface. This class must include writable property definitions that correspond to each parameter that the data type accepts.
  3. 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.IDataTypeConstraintsHandler
    • gw.datatype.handler.IDataTypePersistenceHandler
    • gw.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.

What to do next

For a discussion of constraints, persistence, and presentation as it relates to data types, see Overview of data types.