mirror of
https://github.com/alibaba/fastjson.git
synced 2026-10-29 06:06:50 +08:00
JSONType.parserFeatures support 'Feature.NonPublicFieldSupport'
This commit is contained in:
@@ -779,7 +779,10 @@ public class JavaBeanDeserializer implements ObjectDeserializer {
|
||||
}
|
||||
}
|
||||
|
||||
if (fieldDeserializer == null && parser.lexer.isEnabled(Feature.SupportNonPublicField)) {
|
||||
final int mask = Feature.SupportNonPublicField.mask;
|
||||
if (fieldDeserializer == null
|
||||
&& ((parser.lexer.features & mask) != 0
|
||||
|| (this.beanInfo.parserFeatures & mask) != 0)) {
|
||||
if (this.extraFieldDeserializers == null) {
|
||||
ConcurrentHashMap extraFieldDeserializers = new ConcurrentHashMap<String, Object>(1, 0.75f, 1);
|
||||
Field[] fields = this.clazz.getDeclaredFields();
|
||||
|
||||
@@ -35,6 +35,8 @@ class JavaBeanInfo {
|
||||
|
||||
public final String typeName;
|
||||
|
||||
public final int parserFeatures;
|
||||
|
||||
JavaBeanInfo(Class<?> clazz, //
|
||||
Constructor<?> defaultConstructor, //
|
||||
Constructor<?> creatorConstructor, //
|
||||
@@ -49,6 +51,8 @@ class JavaBeanInfo {
|
||||
this.factoryMethod = factoryMethod;
|
||||
this.fields = fields;
|
||||
this.jsonType = jsonType;
|
||||
|
||||
int parserFeatures = 0;
|
||||
if (jsonType != null) {
|
||||
String typeName = jsonType.typeName();
|
||||
if (typeName.length() != 0) {
|
||||
@@ -56,9 +60,14 @@ class JavaBeanInfo {
|
||||
} else {
|
||||
this.typeName = clazz.getName();
|
||||
}
|
||||
|
||||
for (Feature feature : jsonType.parseFeatures()) {
|
||||
parserFeatures |= feature.mask;
|
||||
}
|
||||
} else {
|
||||
this.typeName = clazz.getName();
|
||||
}
|
||||
this.parserFeatures = parserFeatures;
|
||||
|
||||
boolean supportBeanToArray = false;
|
||||
if (jsonType != null) {
|
||||
|
||||
Reference in New Issue
Block a user