私はJaspersoft Studioの6.2.0を使用し、依存関係を持つMavenプロジェクトでレポートをコンパイル:Jaspersoft Studio 6.2.0でラムダ式を使用できますか?
<dependency>
<groupId>net.sf.jasperreports</groupId>
<artifactId>jasperreports</artifactId>
<version>6.2.0</version>
</dependency>
<dependency>
<groupId>net.sf.jasperreports</groupId>
<artifactId>jasperreports-fonts</artifactId>
<version>6.0.0</version>
</dependency>
レポートは私がlabmda式を使用しようとしました
JRBeanArrayDataSource beanDS = new JRBeanArrayDataSource(new Incident[]{incident}, false);
が供給され、バンドの表現。それを認識していないようです。式は次のとおりです。
$F{actionList} == null || $F{actionList}.stream().allMatch(a -> ActionStatus.COMPLETED.equals(a.getStatus()))
ActionStatusは列挙型です。 (これがために設定されているインシデントのオブジェクトに同じものであるんその
this.hasAllActionsCompleted()
:私も直接のようなオブジェクトからメソッドを使用してみました
net.sf.jasperreports.engine.JRException: Errors were encountered when compiling report expressions class file:
1. a cannot be resolved to a variable
(((java.util.List)field_actionList.getValue()) == null || ((java.util.List)field_actionList.getValue()).stream().allMatch(a -> ActionStatus.COMPLETED.equals(a.getStatus()))) //$JR_EXPR_ID=248$
^
2. Syntax error on token "-", -- expected
(((java.util.List)field_actionList.getValue()) == null || ((java.util.List)field_actionList.getValue()).stream().allMatch(a -> ActionStatus.COMPLETED.equals(a.getStatus()))) //$JR_EXPR_ID=248$
:そして、私のような構文エラーを取得しますレポートのDS):
/**
* Checks if the incident has all actions completed
* @return true if all actions are completed or none defined, false otherwise
*/
public boolean hasAllActionsCompleted() {
return actionList == null || actionList.stream().allMatch(a -> ActionStatus.COMPLETED.equals(a.getStatus()));
}
と私が取得:
net.sf.jasperreports.engine.JRException: Errors were encountered when compiling report expressions class file:
1. The method hasAllActionsCompleted() is undefined for the type Incident_1461053626798_784639
this.hasAllActionsCompleted() //$JR_EXPR_ID=248$
これを行う別の方法はありますか?または、ラムダ式の結果をレポートのパラメータに設定する必要があります(これは明らかな回避策ですが、私は直接アプローチを望んでいました)。