Printing out variables and values in a Groovy object

前端 未结 3 1063
逝去的感伤
逝去的感伤 2020-12-14 14:35

How can I print out the (public and internal) variables and their values of a Groovy object?

I.e

class X
{
  def X = 10
  def Y = 5

  private void d         


        
3条回答
  •  失恋的感觉
    2020-12-14 15:20

    dump()

    For example

    println "ffffd".dump()
    

    Prints:

    java.lang.String@2ef900 value=ffffdd offset=0 count=4 hash=3078400

提交回复
热议问题