Composite Transformations

Composite Transformations are transformations that combine multiple transformations into one logical work unit. Composite transformations provided by Transform4J are the following:

Composite Description
JoiningDataSource Will join two disparate data sources into one. See JoiningDataSource.
ChainedTarget Will perform a series of smaller transformations on a given input. See ChainedTarget.

Next section.

Joining multiple data sources together

Data sources can be combined using JoiningDataSource. JoiningDataSource will combine two data sources into a single data source based on key fields you provide. JoiningDataSource can be stacked; that is, one JoiningDataSource can take another JoiningDataSource as input and allow users to combine any number of sources into one. See JoiningDataSource.

An example of usage follows:

JoiningDataSource source = new JoiningDataSource(myDatabaseSource, new String[]{"customer_id"}, myMongoDBSource, new String[]{"customerId"});
myTransformation.setTransformerDataSource(source);
				

Executing a series of Transformations in sequence

Transformations can be combined using ChainedTarget. ChainedTarget allows users to string a series of transformations together. Chained feed all records written to them to a child transformation (extension of Transformer). There's no limit to how many transformations can be "chained" or strung together. In essence, ChainedTarget is a transient target that simply initiates another transformation using the data written to it. See ChainedTarget.

An example of usage follows. In this example, each record processed by myTransformation is written to a chained target which will further process that record and output it to another target.

mySecondTransformation.setTransformerDataTarget(myRealTarget);

ChainedTarget chainedTarget = new ChainedTarget(mySecondTransformation);
myTransformation.setTransformerDataTarget(chainedTarget);
				

Next section.