Jump to content
We've recently updated our Privacy Statement, available here ×

Casting problem in JasperReports 4.0.0


ejhellerattc

Recommended Posts

Our reports read data via an SQL query. Some of the values returned are enumeration values. In order to obtain meaningful text for the values, we call methods in an external JAR file (i.e., our application). The methods declare the arguments to be shorts. Appropriately the fields are also declared as shorts (java.lang.Short). In version 3.7.3 and earlier this worked fine. In version 4.0.0, the Groovy compiler complains that there is no method available with an argument of Integer. By adding the method ".shortValue()" to the field in the method call, it works.

So:

With the field name as:

<field name="OPERATIONMODE" class="java.lang.Short"/>

This worked in 3.7.3:

...findByValue($F{OPERATIONMODE}).getLongName()

But for 4.0.0 it had to be changed to:

...findByValue($F{OPERATIONMODE}.shortValue()).getLongName()

 

Any thoughts as to why or how we can avoid the additional coding?

Thanks,

Ed.

Link to comment
Share on other sites

  • Replies 0
  • Created
  • Last Reply

Top Posters In This Topic

Popular Days

Top Posters In This Topic

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

×
×
  • Create New...