如何进一步调试以在 groovy 脚本中公开元素中的值
how to further debug to expose the values in the element in groovy script
嗨,我是 groovy 的新手,我遇到了一个问题。目前我正在尝试查看 typeCache[alias]
中的值,它似乎是一个哈希表。
protected static Hashtable typeCache = new Hashtable();
logger.error "this is type cache : " + typeCache[alias].get(indx)[1];
当我输出元素时,我在日志中得到以下结果:-
this is type cache : [com.abcd.util.TypeElement@5dc97ce, com.abcd.util.TypeElement@270a8a6, com.abcd.util.TypeElement@5d421487]
我能否进一步展示这些元素,看看它们里面有什么,它在做什么??我习惯了 php 编程,通常在这种情况下我会做一个 var_dump 在 groovy 中是否有等效的 var_dump ?
谢谢。
每个对象都有一个方法,生成一个
public String dump()
Generates a detailed dump string of an object showing its class, hashCode and fields. http://docs.groovy-lang.org/latest/html/groovy-jdk/java/lang/Object.html#dump%28%29
此 post 包含示例,但请务必阅读评论,因为答案尚未更正。
嗨,我是 groovy 的新手,我遇到了一个问题。目前我正在尝试查看 typeCache[alias]
中的值,它似乎是一个哈希表。
protected static Hashtable typeCache = new Hashtable();
logger.error "this is type cache : " + typeCache[alias].get(indx)[1];
当我输出元素时,我在日志中得到以下结果:-
this is type cache : [com.abcd.util.TypeElement@5dc97ce, com.abcd.util.TypeElement@270a8a6, com.abcd.util.TypeElement@5d421487]
我能否进一步展示这些元素,看看它们里面有什么,它在做什么??我习惯了 php 编程,通常在这种情况下我会做一个 var_dump 在 groovy 中是否有等效的 var_dump ?
谢谢。
每个对象都有一个方法,生成一个
public String dump()
Generates a detailed dump string of an object showing its class, hashCode and fields. http://docs.groovy-lang.org/latest/html/groovy-jdk/java/lang/Object.html#dump%28%29
此 post 包含示例,但请务必阅读评论,因为答案尚未更正。