Fastjson介绍
Fastjson介绍Fastjson是一个Java语言编写的高性能功能完善的JSON库。由阿里巴巴 高性能fastjson采用独创的算法,将parse的速度提升到极致,超过所有json库,包括曾经号称最快的jackson。并且还超越了google的二进制协议protocol buf。 支持标准
功能强大
无依赖
支持范围广
开源
测试充分
下载http://code.alibabatech.com/mvn/releases/com/alibaba/fastjson/ 性能测试:
------------------------------------------------------------------------------------------------------ -----------------------------------------------------------------------------------------------------------
详细:fastjson 项目介绍
问题解决背景:刚接触这个开源项目不久。遇到问题也不少。不过通过各方询问、及源码探究开源得到解决。最近使用FastJson结合hibernate做项目,发现关于对象的级联属性的过滤上用的不是很顺。当然简单的属性过滤@温少已经提供了 SimplePropertyPreFilter 使用,使用方法有详细说明的。这里我针对级联属性的过滤对该类做了补充。(当然你也可以使用注解实现) ok、上代码:
测试代码:
|
test
;
ArrayList
;
;
List
;
;
ComplexPropertyPreFilter
;
A
{
aid
;
B
b
;
List
<
C
c
ArrayList
;
A
{
;
}
{
A
a
;
a
setAid
1
;
B
b
B
;
setBid
2
;
setB
;
setA
;
C
C
;
c
setId
3
;
getC
add
;
;
;
;
ComplexPropertyPreFilter
filter
;
filter
setExcludes
{
final
long
serialVersionUID
-
8411128674046835592L
;
{
put
A
{
"aid"
}
;
B
"bid"
"a"
;
C
"a"
"b"
;
}
;
toJSONString
;
}
getAid
{
;
}
{
aid
;
}
getB
{
;
}
(
B
{
;
}
{
;
}
setC
{
;
}
|