[#12561] - Nested Type for Fields

Category:
Feature request
Priority:
Normal
Status:
Resolved
Project: Severity:
Minor
Resolution:
Fixed
Component: Reproducibility:
N/A
Assigned to:

It will be very userful to specify nested type for Field, if Field declared as Collection. As it was done for Parameters.
Specified generic type allows to use typesafe lambda expressions like:
$F{myField}.stream().map(MyObj::getName).collect(Collectors.joining(", "))

Grammer's picture
89
Joined: Aug 14 2014 - 3:08pm
Last seen: 4 months 3 weeks ago

6 Comments:

#1
  • Status:New» Feedback Requested
  • Assigned:nobody» teodord

Hi,

Are you saying that you tried this kind of expression on a parameter and it worked?
I ask because we don't actually use the nestedType in JRL itself. It is used in JasperServer, but not in the library itself.

Thanks,
Teodor

#2

I don't try it with Parameters, its my fail. I was thinking it works, as I expected :)
So, this feature request may be closed as No Change Required, or renamed to "Implement Generic Types support (Parameters, Fields and expressions)".

#3

Hi,

I think one possible solution is to add a custom property to parameters, fields and variables so that you can specify exactly to which class you want the reference to be automatically cast when the expression is generated.

Thanks,
Teodor

#4
  • Resolution:Open» Fixed
  • Status:Feedback Requested» Resolved

Hi,

Decided to allow the use of generics in the class attribute of fields, parameters and variables. These are ignored when the actual class is loaded internally, but help in expressions to cast the reference to the desired type.
Note that you also need to import some of the classes you use in the report expressions. This only help with the automatic cast.

This will be part of the next release.

Thank you,
Teodor

#5
  • Assigned:nobody»

I set one parameter to be a java.util.List, put the type of the elements of the list to be String, used the List as this: $P{myList}.get(1). This should be understood as a String, but instead I get error saying it's an object.

#6

The change is part of JasperReports since version 6.12.0.

Please explain the problem that you have with a concrete example (minimal JRXML to reproduce it, full error/exception stacktrace, etc).

Regards,
Lucian

Feedback
randomness