You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
arthas/_sources/getstatic.md.txt

25 lines
708 B
Plaintext

This file contains ambiguous Unicode characters!

This file contains ambiguous Unicode characters that may be confused with others in your current locale. If your use case is intentional and legitimate, you can safely ignore this warning. Use the Escape button to highlight these characters.

getstatic
===
通过getstatic命令可以方便的查看类的静态属性。使用方法为`getstatic class_name field_name`
如果该静态属性是一个复杂对象还可以支持在该属性上通过ognl表示进行遍历过滤访问对象的内部属性等操作。
例如假设n是一个MapMap的Key是一个Enum我们想过滤出Map中Key为某个Enum的值可以写如下命令
```
$ getstatic com.alibaba.arthas.Test n 'entrySet().iterator.{? #this.key.name()=="STOP"}'
field: n
@ArrayList[
@Node[STOP=bbb],
]
Affect(row-cnt:1) cost in 68 ms.
$ getstatic com.alibaba.arthas.Test m 'entrySet().iterator.{? #this.key=="a"}'
field: m
@ArrayList[
@Node[a=aaa],
]
```