JSON schema wrapper types
It is possible to generate schema wrapper types based on the JSON schema definitions. As
you need to generate the wrapper classes explicitly (and not at build time like other code
generators), you need to check the generated classes into source control. The generated
classes do not represent DTO objects (Data Transfer Objects), but instead represent wrappers
around a JsonObject object.
- Create a new wrapper instance that contains a new, empty
JsonObjectobject - Wrap an existing
JsonObjectinstance
For more information on the JSON schema wrapper classes, see the Guidewire JSON specification in the PolicyCenter Integration Guide.
Generate schema wrapper classes
JSON schema wrapper classes contain statically typed getter and setter methods on the specified object.
Procedure
-
In Guidewire studio, create a codegen-schemas.txt file in the
following directory, if one does not already exist:
-
In codegen-schemas.txt, list the fully qualified names of the
schemas for which you want to generate wrapper classes, each schema on its own separate
line.
For example, enter the fully qualified name of a schema in the following form:
- gw.pl.system.cluster_tools-1.0
Use a dot separator (.), not a slash (/) and leave off the
.schema.jsonfile ending. -
On the Studio toolbar, select .
This action opens a Run/Debug Configurations dialog.
-
In the dialog toolbar, click +, then select
Application from the drop-down.
This action adds a new unnamed, node under Application.
-
Enter the following data in the dialog fields:
Option Description Name codgen Main class com.guidewire.tools.json.JsonSchemaWrapperCodegenTool Working directory Enter the root directory of your PolicyCenter installation, for example: - C:/PolicyCenter/10.1.2/
Use classpath of module configuration Before launch: Make (including OSGI Bundles), Activate tool window Select Make (Including OSGI Bundles) . You can accept the defaults for the remainder of the dialog fields, or, change the fields to meet your specific needs.
-
On the Studio toolbar, select .
Studio opens a pane at the bottom of the Studio screen that logs the activity of the code generation operation. After the code generation operation completes, Studio places the generated wrapper classes in the following directory in Studio:
- If you are using source control for the PolicyCenter application files managed by Studio, you need to check the newly generated class files into source control as well.
