This repository has been archived by the owner on Oct 23, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 6.5k
Feature_DisableFieldSmartMatch_cn
高铁 edited this page Apr 3, 2017
·
1 revision
如果输入json文本和JavaBean的属性不是精确匹配时,fastjson会通过多种匹配方式查找属性,会消耗较多的资源。在1.2.30中,引入了Feature.DisableFieldSmartMatch ,可以解决这个问题。
@JSONType(parseFeatures = Feature.DisableFieldSmartMatch)
public static class Model_for_disableFieldSmartMatchMask2 {
public int personId;
}
assertEquals(0, JSON.parseObject("{\"person_id\":123}", Model_for_disableFieldSmartMatchMask2.class).personId);
public static class Model_for_disableFieldSmartMatchMask {
public int personId;
}
assertEquals(123
, JSON.parseObject("{\"person_id\":123}"
, Model_for_disableFieldSmartMatchMask.class).personId);
assertEquals(0
, JSON.parseObject("{\"person_id\":123}"
, Model_for_disableFieldSmartMatchMask.class, Feature.DisableFieldSmartMatch).personId);
如有需要修改本注脚,请联系阿里巴巴,
© Alibaba Fastjson Develop Team
注明: 版权所有阿里巴巴,请注明版权所有者
If you need to amend this footnote, please contact Alibaba.
© Alibaba Fastjson Develop Team
Note: Copyright Alibaba, please indicate the copyright owner