【开源中国 APP 全新上线】“动弹” 回归、集成大模型对话、畅读技术报告”
com.alibaba.fastjson.JSON类中的一段代码,求大神指导这个是啥意思
public abstract class JSON implements JSONStreamAware, JSONAware {
//.....
//这个static下面的代码是干啥的?
static {
int features = 0;
features |= Feature.AutoCloseSource.getMask();
features |= Feature.InternFieldNames.getMask();
features |= Feature.UseBigDecimal.getMask();
features |= Feature.AllowUnQuotedFieldNames.getMask();
features |= Feature.AllowSingleQuotes.getMask();
features |= Feature.AllowArbitraryCommas.getMask();
features |= Feature.SortFeidFastMatch.getMask();
features |= Feature.IgnoreNotMatch.getMask();
DEFAULT_PARSER_FEATURE = features;
}
经过上边的操作 features 的二进制值就表示了上述所有状态,这个是节省空间,快速判断当前特性的操作。
默认转换的属性, |=按位或赋值