Time for action – counting frequent words by coding in Java
In this section, we will redo the transformation from the Time for action – counting frequent words by coding in JavaScript section, but this time we will code in Java rather than in JavaScript.
- Open the transformation from the Time for action – counting frequent words by coding in JavaScript section of this chapter and save it as a new transformation.
- Delete the JavaScript step and in its place, add a User Defined Java Class step. You will find it under the Scripting category of steps. You will have the following:
- Double-click on the User Defined Java Class step—UDJC from now on—and in the Processor tab, type the following:
public boolean processRow(StepMetaInterface smi,StepDataInterface sdi) throws KettleException { Object[] r = getRow(); if (r == null) { setOutputDone(); return false; } if (first) { first = false; } r = createOutputRow(r, data.outputRowMeta...