当前位置:网站首页>Arthas watch command to view the properties of objects in the array
Arthas watch command to view the properties of objects in the array
2022-07-26 01:17:00 【Buckle shocker nail】
Look at the elements in the array
Love it Arthas , Helped me troubleshoot many code problems .
In use today Arthas Of watch When the command checks the input parameters of a method , It is found that the corresponding input parameter object is a little complex , Roughly, an object contains an array object , Then I need an attribute in the corresponding array object . Because I haven't encountered such a scene before , So I'm writing watch I don't know how to write the order , After looking for a long time, I finally found the corresponding writing method , Sit down here and sum up .
public class Main{
public static void method1(OrgDTO org){
// do nothing
}
}
public class OrgDTO{
private String name;
private List<OrgDTO> children;
}
The above is probably the scene I encountered , I need to get method1 Method into the children Of each element in name attribute , After checking the information , Knowing this kind of scene is called Attribute projection / Set projection / Expression projection .
Use ognl The expression is written as {params[0].children.{name}}:
watch org.example.Main method1 {
params[0].children.{
name}} -x 2
Call the method of each element in the array
Of course , The above is a simple way of writing , In fact, we can also call the methods of each object , Get its return result :{params[0].children.{getName()}}.
watch org.example.Main method1 {
params[0].children.{
getName()}} -x 2
In this way , We can get children For each object in the array getName() Return value of method .
Use expressions to filter
There is another way to filter expressions , You can specify filter conditions in curly braces to filter array objects :
# Filter children Name length is greater than 5 The elements of
watch org.example.Main method1 {
params[0].children.{
? name.length() > 5}} -x 2
First summarize these , In fact, the corresponding parameter viewing method is very flexible , The following resources have been introduced in great detail , You can take what you need .
Reference material
Arthas file
Flexible use ognl expression
ognl Official documents
Arthas Some special usage documentation for
边栏推荐
- Lock upgrade: no lock, bias lock, lightweight lock, heavyweight lock
- IP地址能精确到哪步?动态IP及静态IP是什么?切换IP最常用的方法
- [CTF] crypto preliminary basic outline
- NIO简易示例
- [software development specification II] prohibited item development specification
- The Chinese input (Pinyin input method) component created by lvgl official +100ask enables lvgl to support Chinese input!
- "Yuanqi Cola" is not the end point, "China Cola" is
- Should we test the Dao layer?
- Docker advanced -mysql master-slave replication
- 代理IP服务器如何保证自身在网络中的信息安全呢
猜你喜欢

Handler消息机制-FWK层

谷歌浏览器调试工具使用基础版(一)

Browser development and use skills

Docker高级篇-Mysql主从复制

Codeforces Round #810 (Div. 2)A~C

Detailed explanation of at and crontab commands of RHCE and deployment of Chrony

Modify CSV

MulDA: A Multilingual Data Augmentation Framework for Low-Resource Cross-Lingual NER 阅读笔记

【ctf】Crypto初步基础概要
![[Go]三、最简单的RestFul API服务器](/img/1f/f6fc8cc9a3891d01a25e709170188d.png)
[Go]三、最简单的RestFul API服务器
随机推荐
[go] how to control the maximum number of concurrent processes
Tutorial on the principle and application of database system (057) -- MySQL exercises
NIO简易示例
谷歌浏览器调试工具使用基础版(一)
[RTOS training camp] course learning methods and C language knowledge (pointer, structure, function pointer, linked list) and student questions
API测试简介
Mulda: a multilingual data augmentation framework for low resource cross linguistic ner reading notes
Sqli-labs Less7
【纪中】2022.7.16 1432.输油管道
换ip软件的用途很广及原理 动态IP更换的四种方法来保护网络隐私
EasyRecovery15下载量高的恢复率高的数据恢复软件
Timeout settings for feign and hystrix
iNFTnews | 假如这是元宇宙20年后的样子
Detailed explanation of at and crontab commands of RHCE and deployment of Chrony
Cross-lingual Transfer of Correlations between Parts of Speech and Gaze Features 阅读笔记
Causes of signal degradation in optical fiber communication
数据库系统原理与应用教程(055)—— MySQL 查询(十七):数学函数的用法
【数据挖掘】生成模型和判别模型的区别及优缺点
《自然语言处理实战入门》深度学习基础 ---- attention 注意力机制 ,Transformer 深度解析与学习材料汇总
What are the ways to quickly improve programming skills in the process of programming learning?