Prabhjot Rai Prabhjot Rai - 5 months ago 47
Java Question

How to create an ArrayList object in an User Defined Java Class in Kettle?

I am trying to declare an

ArrayList
object in an User Defined Java Class object in pentaho kettle. I am trying a simple code inside the
User Defined Java Class
:


import java.util.List;
import java.util.ArrayList;

List<String> where = new ArrayList<String>();

public boolean processRow(StepMetaInterface smi, StepDataInterface sdi) throws KettleException
{

return true;

}


But when I test this class, I get an error:

Line 4, Column 6: Identifier expected


What can be the issue? If I comment out the line
List<String> where = new ArrayList<String>();
the code works well.

Answer

As mentioned on the Pentaho wiki Janino doesn't support generics.

Another thing to note is that Janino, essentially a Java byte-code generator only supports a sub-set of the Java 1.5 specification. To see a complete list of the features and limitations, please go to the Janino homepage. At the time of writing the most apparent limitation is the absence of generics.

So, you should use a simple List like this :

List where;

instead of using generics.

Comments