Vardump 更新,支持打印各种 Java 数据结构,支持嵌套

栏目: 软件资讯 · 发布时间: 5年前

内容简介:1、更新支持同时打印http请求的request的cookies,session,parameter。 //请求的url为http://localhost/?a=1&b=2&b=123 @RequestMapping("/index") public String index(HttpServletRequest request) { ...

1、更新支持同时打印http请求的request的cookies,session,parameter。

//请求的url为http://localhost/?a=1&b=2&b=123
@RequestMapping("/index")
public String index(HttpServletRequest request) {
	Vardump.print(request);		
	return "index/index";
}

打印的效果如下

request(
    ParameterMap(
        {(string)"a" (length=1)=>
                String[](
                    [0]=>(string)"1" (length=1)
                )
        }
        {(string)"b" (length=1)=>
                String[](
                    [0]=>(string)"2" (length=1)
                    [1]=>(string)"123" (length=3)
                )
        }
    )
    cookies(
        (string)"{(string)"__guid"(length=6)=>(string)111872281.412025206174933600.1541334635043.79(length=45)}" (length=94)
        (string)"{(string)"JSESSIONID"(length=10)=>(string)EBD3C517709D3A58439311546492EEC9(length=32)}" (length=86)
        (string)"{(string)"monitor_count"(length=13)=>(string)63(length=2)}" (length=58)
    )
    session(
        {(string)"realName"(length=8)=>(string)"系统管理员" (length=5)}
        {(string)"img"(length=3)=>(int)0}
        {(string)"aname"(length=5)=>(string)"admin" (length=5)}
        {(string)"mobile"(length=6)=>(string)"13818135252" (length=11)}
        {(string)"dname"(length=5)=>(string)"行政部" (length=3)}
        {(string)"rid"(length=3)=>
                HashSet(
                    [0]=>(int)1
                )
        }
        {(string)"aid"(length=3)=>(int)23}
        {(string)"did"(length=3)=>(int)3}
        {(string)"email"(length=5)=>(string)"admin@lcfms.cn" (length=14)}
        {(string)"status"(length=6)=>(int)1}
    )
)

2、支持打印各种继承了Map与Collection接口的数据类型,比如Json

JSONObject object=JSONObject.fromObject("{\"employees\":[{\"firstName\":\"Bill\",\"lastName\":\"Gates\"},{\"firstName\":\"George\",\"lastName\":\"Bush\"},{\"firstName\":\"Thomas\",\"lastName\":\"Carter\"}]}");
Vardump.print(object);

打印结果如下

JSONObject(
    {(string)"employees" (length=9)=>
                JSONArray(
                    [0]=>
                        JSONObject(
                            {(string)"firstName" (length=9)=>(string)"Bill" (length=4)}
                            {(string)"lastName" (length=8)=>(string)"Gates" (length=5)}
                        )
                    [1]=>
                        JSONObject(
                            {(string)"firstName" (length=9)=>(string)"George" (length=6)}
                            {(string)"lastName" (length=8)=>(string)"Bush" (length=4)}
                        )
                    [2]=>
                        JSONObject(
                            {(string)"firstName" (length=9)=>(string)"Thomas" (length=6)}
                            {(string)"lastName" (length=8)=>(string)"Carter" (length=6)}
                        )
                )
    }
)

3、处理打印null报错的异常。

4、更新使用文档


【声明】文章转载自:开源中国社区 [http://www.oschina.net]


以上就是本文的全部内容,希望对大家的学习有所帮助,也希望大家多多支持 码农网

查看所有标签

猜你喜欢:

本站部分资源来源于网络,本站转载出于传递更多信息之目的,版权归原作者或者来源机构所有,如转载稿涉及版权问题,请联系我们

Principles of Object-Oriented JavaScript

Principles of Object-Oriented JavaScript

Nicholas C. Zakas / No Starch Press / 2014-2 / USD 24.95

If you've used a more traditional object-oriented language, such as C++ or Java, JavaScript probably doesn't seem object-oriented at all. It has no concept of classes, and you don't even need to defin......一起来看看 《Principles of Object-Oriented JavaScript》 这本书的介绍吧!

JS 压缩/解压工具
JS 压缩/解压工具

在线压缩/解压 JS 代码

RGB转16进制工具
RGB转16进制工具

RGB HEX 互转工具

HSV CMYK 转换工具
HSV CMYK 转换工具

HSV CMYK互换工具