Skip to main content


Transmuters can modify the model in a structural way. They are a great tool for keeping models up-to-date or to add a complex feature.

Transmuters can be executed from the µRadiant or from command line.

Adding new Transmuters

To add a new Transmuter, create a class that implements ModelTransmuter and add @Transmutation:

element = "elements::DataElement",
description = "Some description of what the transmuter will change."
public class AddSomething implements ModelTransmuter<DataElementComposite> {

public void transmute(DataElementComposite dataElement, ModelTransmutationContext context) {
// Implement transmutation


Composite Builder Classes

To help with the implementation of the transmuters, you can make use of the CompositeBuilder classes. These classes provide an API to merge new changes into existing models.

Use the merge() method to update an element.

DataElementCompositeBuilder.merge(dataElement, context, de -> {
// Set the packageName to a new value

// Create a field named `foo` or update it if it already exists
de.fields(field -> {"foo");
field.valueField(vf -> {

You can also merge with a Component to create new DataElements etc.

ComponentCompositeBuilder.merge(dataElement.getComponent(), context, component -> {
component.dataElements(newDataElement -> { + "History");

Writing tests

You can use the TransmuterTester class to test transmutations.

public class AddSomethingTest {

private final ModelSpecBuilder specBuilder = new ModelSpecBuilder();
// If the test is named after the tested class, the TransmuterTester will find it automatically
private final TransmuterTester tester = TransmuterTester.forTest(this);

void testTransmute() {
// Create a model to test
DataElementComposite model = specBuilder.buildAndFind(

tester.testTransmute(model, de -> {
// Assert that the model has been updated
assertThat(de.getComponent().getDataElements(), hasItem(
Public ModelSpecBuilder

The specBuilder field has been made public to allow the TransmuterTester to configure itself. It is also possible to pass the context object to the tester instead.

private final ModelSpecBuilder specBuilder = new ModelSpecBuilder();
private final TransmuterTester tester = TransmuterTester.forTest(this, specBuilder.getContext());

Creating a new transmutation project

To create a new transmutation resource project you will need to create a maven project.

Add the following dependencies to the project:

<!-- Provides annotations and interfaces for the transmuters -->
<!-- Provides CompositeBuilder classes for elements -->
<!-- Provides tester class -->

If not present yet, add the expansionResource goal to the <plugins> section in your pom.xml. Also make sure it has the includeClassPathDependencies flag enabled.

include ClassPath Dependencies

This flag directs the expansionResource manifest generator to include a list of all compile project dependencies. This way, the expanders will fetch these dependencies when expanding. Without this, the prime-builders jar might not be present or might be the wrong version.