how to display values of business variable instead of "com.company.model.StudyLeave@74aa5dec"

1
0
-1

i have business variable "StudyLeave" with this attribute:

  • percentage
  • startdate
  • enddate
  • studydays

i want to display the values that i have submitted in instantiation form , Here is the script that i used to display my business variables:

  • import java.util.logging.Logger
  • def logger = Logger.getLogger(this.getClass().getName())
  • logger.info("display my list:" + StudyLeave)

i choose from business variables "StudyLeave" to show all the object that have submit in the instantiation form , but the result display "com.company.model.StudyLeave@74aa5dec" instead of list of the value that i have entered in the form.

1 answer

1
+1
-1
This one is the BEST answer!

Hi,

This is the default toString() method behavior in Java. You cav build your own string in your log like this:

logger.info("StudyLeave [ startDate: ${StudyLeave.startdate}, enddate: ${StudyLeave.startdate},  studydays:  ${StudyLeave.studydays}, percentage: ${StudyLeave.percentage}")

HTH
Romain

Comments

Submitted by webDev on Mon, 02/20/2023 - 09:25

So I don't have other choice, I must build my own string?

Notifications