2016-06-29 5 views
3

私はArrayListオブジェクトをpentahoケトルのユーザー定義Javaクラスオブジェクトで宣言しようとしています。私はUser Defined Java Class内側に簡単なコードしようとしています:
ケトルのユーザー定義JavaクラスでArrayListオブジェクトを作成する方法は?

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; 

} 

をしかし、私はこのクラスをテストするとき、私はエラーを取得する:

Line 4, Column 6: Identifier expected

問題となることがありますか?私がList<String> where = new ArrayList<String>();という行をコメントアウトすると、コードはうまく動作します。

+1

クラス宣言がどこにあるのかわかりません。 –

+0

Kettleの 'User Defined Java Class'ステップでクラスを定義する必要はありません。 Kettleはすでに変換を実行している間、その環境でそれを行います。リストの代わりに 'private String where'を書くと、= new ArrayList (); '、コードはうまく機能します。 –

答えて

5

Pentaho wikiJaninoで述べたように、ジェネリックはサポートしていません。ジェネリックを使用するのではなく、

List where; 

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.

だから、あなたはこのような単純なリストを使用する必要があります。

0

forums.pentaho.comでknown issueでした。組み込みコンパイラはジェネリックを使用しません。

import java.util.List; 

List where; 

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

    return true; 

} 

などのリストオブジェクトを作成するだけで、エラーは発生しません。

関連する問題