Skip to main content
Version: 5.13.0

CDM Java Distribution Guidelines

This section provides directions for downloading and using the Java version of CDM. Topics covered are listed below:

  • Prerequisites
  • Introduction
  • Setting Up Google's Guice Injector
  • Generating Global Keys and Qualifications
  • Validating the CDM instance


  • Java SDK 8 or higher


  • The CDM in Java is built using maven and is published to Maven Central.


In order to use the CDM in a Maven project, the following dependency needs to be added to the project pom.xml:

  • The CDM model objects are classified into namespaces (cdm.base, cdm.base.staticdata, etc). These namespaces translate into Java packages with the same name, with each package containing a package-info file.

  • The CDM uses builder pattern for each of the pojos. The distribution ships with the json to java object serialisers.

NOTE: All current CDM dependencies are available in Maven Central. For CDM releases prior to version 4.0.0 the dependencies can be found in the ISDA repository: artifactregistry:// Add the following two snippets to the <build> and <repositories> sections of your project pom.xml. You can also use the https protocol instead of artifactregistry. If you do this then the <build> extension is not necessary.

<!-- existing contents -->

<!-- remove references to REGnosys Jfrog -->
<!-- existing contents -->

Setting Up Google's Guice Injector

CDM uses Google's Guice as a dependency manager. Injector is the core of Guice that contains the whole object graph (context).

The first step is to initialise the injector. There are two options:

Initialising the Injector, Option 1: Using provided CdmRuntimeModule

The CDM java distribution comes with a pre-built CDM module that can be used to create an injector. It provides bindings to required classes (ModelObjectValidator and QualifyFunctionFactory) as well as binding in implementations for several CDM functions such as Abs, Sum

Injector injector = Guice.createInjector(new CdmRuntimeModule()));

Initialising the Injector, Option 2: Build your own Module

To build a custom injector that is not based on the CDM's runtime module, first create a Guice module with a minimum of the two bindings shown belows:

public class GenericModule extends AbstractModule {

protected void configure() {

Once this module has been built it can be used to create the custom injector.

Injector injector = Guice.createInjector(new GenericModule()));

Generating Global Keys and Qualifications

Within the model any data object marked with metadata key will have a Global Key generated when that data object is populated. These Global Keys are automatically generated using hash algorithms. The model objects can be post-processed with Global Keys and qualified by using the injector created in the previous step to run the code shown below:

Contract cdmInstance = buildCdmInstance();
Contract.ContractBuilder builder = cdmInstance.toBuilder();
keyProcessor.runProcessStep(Contract.class, builder);
Contract updatedCdmInstance =;

Validating the CDM instance

In order to validate the CDM instance, it is necessary to create a RosettaTypeValidator and post process the instance as follows:

RosettaTypeValidator validator = injector.getInstance(RosettaTypeValidator.class);
ValidationReport validationReport = validator.runProcessStep(cdmInstance.getClass(), cdmInstance.toBuilder());
if (validationReport.success()) {
List<ValidationResult<?>> validationResults = validationReport.validationFailures();

If the validation is unsuccessful then the validation results object will contain the list of all the validation failures.