java 8 - Can I use lambda expressions in Jaspersoft Studio 6.2.0? -
i use jaspersoft studio 6.2.0, , compile report in maven project dependencies:
<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>
the report fed
jrbeanarraydatasource beands = new jrbeanarraydatasource(new incident[]{incident}, false);
i have tried use labmda expression in print when expression of band. seems not recognise it. expression is:
$f{actionlist} == null || $f{actionlist}.stream().allmatch(a -> actionstatus.completed.equals(a.getstatus()))
actionstatus enum. , syntax errors like:
net.sf.jasperreports.engine.jrexception: errors encountered when compiling report expressions class file: 1. cannot resolved 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$
i tried using method object directly like:
this.hasallactionscompleted()
that same thing (this in incident object set report's ds) :
/** * checks if incident has actions completed * @return true if actions completed or none defined, false otherwise */ public boolean hasallactionscompleted() { return actionlist == null || actionlist.stream().allmatch(a -> actionstatus.completed.equals(a.getstatus())); }
and get:
net.sf.jasperreports.engine.jrexception: errors encountered when compiling report expressions class file: 1. method hasallactionscompleted() undefined type incident_1461053626798_784639 this.hasallactionscompleted() //$jr_expr_id=248$
is there way this? or should set lambda expression result in parameter report (this obvious walkaround, hoping direct approach)?
and answer change method getter, , use field. in case changed hasallactionscompleted isallactionscompleted , added new field allactionscompleted boolean. worked charm. thank you.
Comments
Post a Comment