本文整理汇总了Java中com.alibaba.fastjson.parser.deserializer.FieldDeserializer类的典型用法代码示例。如果您正苦于以下问题:Java FieldDeserializer类的具体用法?Java FieldDeserializer怎么用?Java FieldDeserializer使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
FieldDeserializer类属于com.alibaba.fastjson.parser.deserializer包,在下文中一共展示了FieldDeserializer类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: createFieldDeserializerWithoutASM
import com.alibaba.fastjson.parser.deserializer.FieldDeserializer; //导入依赖的package包/类
public FieldDeserializer createFieldDeserializerWithoutASM(ParserConfig mapping, Class<?> clazz, FieldInfo fieldInfo) {
Class<?> fieldClass = fieldInfo.getFieldClass();
if (fieldClass == Boolean.TYPE || fieldClass == Boolean.class) {
return new BooleanFieldDeserializer(mapping, clazz, fieldInfo);
}
if (fieldClass == Integer.TYPE || fieldClass == Integer.class) {
return new IntegerFieldDeserializer(mapping, clazz, fieldInfo);
}
if (fieldClass == Long.TYPE || fieldClass == Long.class) {
return new LongFieldDeserializer(mapping, clazz, fieldInfo);
}
if (fieldClass == String.class) {
return new StringFieldDeserializer(mapping, clazz, fieldInfo);
}
if (fieldClass == List.class || fieldClass == ArrayList.class) {
return new ArrayListTypeFieldDeserializer(mapping, clazz, fieldInfo);
}
return new DefaultFieldDeserializer(mapping, clazz, fieldInfo);
}
示例2: handleResovleTask
import com.alibaba.fastjson.parser.deserializer.FieldDeserializer; //导入依赖的package包/类
public void handleResovleTask(Object value) {
if (this.resolveTaskList != null) {
int size = this.resolveTaskList.size();
for (int i = 0; i < size; i++) {
ResolveTask task = (ResolveTask) this.resolveTaskList.get(i);
FieldDeserializer fieldDeser = task.getFieldDeserializer();
if (fieldDeser != null) {
Object refValue;
Object object = null;
if (task.getOwnerContext() != null) {
object = task.getOwnerContext().getObject();
}
String ref = task.getReferenceValue();
if (ref.startsWith("$")) {
refValue = getObject(ref);
} else {
refValue = task.getContext().getObject();
}
fieldDeser.setValue(object, refValue);
}
}
}
}
示例3: createFieldDeserializerWithoutASM
import com.alibaba.fastjson.parser.deserializer.FieldDeserializer; //导入依赖的package包/类
public FieldDeserializer createFieldDeserializerWithoutASM(ParserConfig mapping, Class<?> clazz, FieldInfo fieldInfo) {
Class<?> fieldClass = fieldInfo.getFieldClass();
if (fieldClass == boolean.class || fieldClass == Boolean.class) {
return new BooleanFieldDeserializer(mapping, clazz, fieldInfo);
}
if (fieldClass == int.class || fieldClass == Integer.class) {
return new IntegerFieldDeserializer(mapping, clazz, fieldInfo);
}
if (fieldClass == long.class || fieldClass == Long.class) {
return new LongFieldDeserializer(mapping, clazz, fieldInfo);
}
if (fieldClass == String.class) {
return new StringFieldDeserializer(mapping, clazz, fieldInfo);
}
if (fieldClass == List.class || fieldClass == ArrayList.class) {
return new ArrayListTypeFieldDeserializer(mapping, clazz, fieldInfo);
}
return new DefaultFieldDeserializer(mapping, clazz, fieldInfo);
}
示例4: getFieldDeserializers
import com.alibaba.fastjson.parser.deserializer.FieldDeserializer; //导入依赖的package包/类
public Map<String, FieldDeserializer> getFieldDeserializers(Class<?> clazz) {
ObjectDeserializer deserizer = getDeserializer(clazz);
if (deserizer instanceof JavaBeanDeserializer) {
return ((JavaBeanDeserializer) deserizer).getFieldDeserializerMap();
} else {
return Collections.emptyMap();
}
}
示例5: createFieldDeserializer
import com.alibaba.fastjson.parser.deserializer.FieldDeserializer; //导入依赖的package包/类
public FieldDeserializer createFieldDeserializer(ParserConfig mapping, Class<?> clazz, FieldInfo fieldInfo) {
boolean asmEnable = this.asmEnable;
if (asmEnable) {
Class<?> superClass = clazz;
while (Modifier.isPublic(superClass.getModifiers())) {
superClass = superClass.getSuperclass();
if (superClass != Object.class) {
if (superClass == null) {
break;
}
}
break;
}
asmEnable = false;
}
if (fieldInfo.getFieldClass() == Class.class) {
asmEnable = false;
}
if (asmEnable && this.asmFactory != null && this.asmFactory.isExternalClass(clazz)) {
asmEnable = false;
}
if (!asmEnable) {
return createFieldDeserializerWithoutASM(mapping, clazz, fieldInfo);
}
try {
return this.asmFactory.createFieldDeserializer(mapping, clazz, fieldInfo);
} catch (Throwable th) {
return createFieldDeserializerWithoutASM(mapping, clazz, fieldInfo);
}
}
示例6: getFieldDeserializers
import com.alibaba.fastjson.parser.deserializer.FieldDeserializer; //导入依赖的package包/类
public Map<String, FieldDeserializer> getFieldDeserializers(Class<?> clazz) {
ObjectDeserializer deserizer = getDeserializer((Type) clazz);
if (deserizer instanceof JavaBeanDeserializer) {
return ((JavaBeanDeserializer) deserizer).getFieldDeserializerMap();
}
if (deserizer instanceof ASMJavaBeanDeserializer) {
return ((ASMJavaBeanDeserializer) deserizer).getInnterSerializer().getFieldDeserializerMap();
}
return Collections.emptyMap();
}
示例7: createFieldDeserializer
import com.alibaba.fastjson.parser.deserializer.FieldDeserializer; //导入依赖的package包/类
public FieldDeserializer createFieldDeserializer(ParserConfig mapping, Class<?> clazz, FieldInfo fieldInfo) {
boolean asmEnable = this.asmEnable;
if (asmEnable) {
Class<?> superClass = clazz;
for (;;) {
if (!Modifier.isPublic(superClass.getModifiers())) {
asmEnable = false;
break;
}
superClass = superClass.getSuperclass();
if (superClass == Object.class || superClass == null) {
break;
}
}
}
if (fieldInfo.getFieldClass() == Class.class) {
asmEnable = false;
}
if (asmEnable && asmFactory != null && asmFactory.isExternalClass(clazz)) {
asmEnable = false;
}
if (!asmEnable) {
return createFieldDeserializerWithoutASM(mapping, clazz, fieldInfo);
}
try {
return asmFactory.createFieldDeserializer(mapping, clazz, fieldInfo);
} catch (Throwable e) {
// skip
}
return createFieldDeserializerWithoutASM(mapping, clazz, fieldInfo);
}
示例8: getFieldDeserializers
import com.alibaba.fastjson.parser.deserializer.FieldDeserializer; //导入依赖的package包/类
public Map<String, FieldDeserializer> getFieldDeserializers(Class<?> clazz) {
ObjectDeserializer deserizer = getDeserializer(clazz);
if (deserizer instanceof JavaBeanDeserializer) {
return ((JavaBeanDeserializer) deserizer).getFieldDeserializerMap();
} else if (deserizer instanceof ASMJavaBeanDeserializer) {
return ((ASMJavaBeanDeserializer) deserizer).getInnterSerializer().getFieldDeserializerMap();
} else {
return Collections.emptyMap();
}
}
示例9: handleResovleTask
import com.alibaba.fastjson.parser.deserializer.FieldDeserializer; //导入依赖的package包/类
public void handleResovleTask(Object value) {
if (resolveTaskList == null) {
return;
}
int size = resolveTaskList.size();
for (int i = 0; i < size; ++i) {
ResolveTask task = resolveTaskList.get(i);
FieldDeserializer fieldDeser = task.getFieldDeserializer();
if (fieldDeser == null) {
continue;
}
Object object = null;
if (task.getOwnerContext() != null) {
object = task.getOwnerContext().getObject();
}
String ref = task.getReferenceValue();
Object refValue;
if (ref.startsWith("$")) {
refValue = getObject(ref);
} else {
refValue = task.getContext().getObject();
}
fieldDeser.setValue(object, refValue);
}
}
示例10: createFieldDeserializer
import com.alibaba.fastjson.parser.deserializer.FieldDeserializer; //导入依赖的package包/类
public FieldDeserializer createFieldDeserializer(ParserConfig mapping, Class<?> clazz, FieldInfo fieldInfo) {
boolean asmEnable = this.asmEnable;
if (asmEnable) {
Class<?> superClass = clazz;
for (;;) {
if (!Modifier.isPublic(superClass.getModifiers())) {
asmEnable = false;
break;
}
superClass = superClass.getSuperclass();
if (superClass == Object.class || superClass == null) {
break;
}
}
}
if (fieldInfo.getFieldClass() == Class.class) {
asmEnable = false;
}
if (asmFactory.isExternalClass(clazz)) {
asmEnable = false;
}
if (!asmEnable) {
return createFieldDeserializerWithoutASM(mapping, clazz, fieldInfo);
}
try {
return asmFactory.createFieldDeserializer(mapping, clazz, fieldInfo);
} catch (Throwable e) {
// skip
}
return createFieldDeserializerWithoutASM(mapping, clazz, fieldInfo);
}
示例11: handleResovleTask
import com.alibaba.fastjson.parser.deserializer.FieldDeserializer; //导入依赖的package包/类
public static void handleResovleTask(DefaultJSONParser parser, Object value) {
List<ResolveTask> resolveTaskList = parser.getResolveTaskListDirect();
if (resolveTaskList == null) {
return;
}
int size = resolveTaskList.size();
for (int i = 0; i < size; ++i) {
ResolveTask task = resolveTaskList.get(i);
FieldDeserializer fieldDeser = task.getFieldDeserializer();
if (fieldDeser == null) {
continue;
}
Object object = null;
if (task.getOwnerContext() != null) {
object = task.getOwnerContext().getObject();
}
String ref = task.getReferenceValue();
Object refValue;
if (ref.startsWith("$")) {
refValue = parser.getObject(ref);
} else {
refValue = task.getContext().getObject();
}
fieldDeser.setValue(object, refValue);
}
}
示例12: createFieldDeserializerWithoutASM
import com.alibaba.fastjson.parser.deserializer.FieldDeserializer; //导入依赖的package包/类
public FieldDeserializer createFieldDeserializerWithoutASM(ParserConfig mapping, Class<?> clazz, FieldInfo fieldInfo) {
Class<?> fieldClass = fieldInfo.getFieldClass();
if (fieldClass == boolean.class || fieldClass == Boolean.class) {
return new BooleanFieldDeserializer(mapping, clazz, fieldInfo);
}
if (fieldClass == int.class || fieldClass == Integer.class) {
return new IntegerFieldDeserializer(mapping, clazz, fieldInfo);
}
if (fieldClass == long.class || fieldClass == Long.class) {
return new LongFieldDeserializer(mapping, clazz, fieldInfo);
}
if (fieldClass == String.class) {
return new StringFieldDeserializer(mapping, clazz, fieldInfo);
}
if (fieldClass == List.class || fieldClass == ArrayList.class) {
Type fieldType = fieldInfo.getFieldType();
if (fieldType instanceof ParameterizedType) {
Type itemType = ((ParameterizedType) fieldType).getActualTypeArguments()[0];
if (itemType == String.class) {
return new ArrayListStringFieldDeserializer(mapping, clazz, fieldInfo);
}
}
return new ArrayListTypeFieldDeserializer(mapping, clazz, fieldInfo);
}
return new DefaultFieldDeserializer(mapping, clazz, fieldInfo);
}
示例13: handleResovleTask
import com.alibaba.fastjson.parser.deserializer.FieldDeserializer; //导入依赖的package包/类
public static <T> int handleResovleTask(DefaultJSONParser parser, T value) {
if (parser.isEnabled(Feature.DisableCircularReferenceDetect)) {
return 0;
}
int size = parser.getResolveTaskList().size();
for (int i = 0; i < size; ++i) {
ResolveTask task = parser.getResolveTaskList().get(i);
FieldDeserializer fieldDeser = task.getFieldDeserializer();
Object object = null;
if (task.getOwnerContext() != null) {
object = task.getOwnerContext().getObject();
}
String ref = task.getReferenceValue();
Object refValue;
if (ref.startsWith("$")) {
refValue = parser.getObject(ref);
} else {
refValue = task.getContext().getObject();
}
fieldDeser.setValue(object, refValue);
}
return size;
}
示例14: getFieldDeserializer
import com.alibaba.fastjson.parser.deserializer.FieldDeserializer; //导入依赖的package包/类
public FieldDeserializer getFieldDeserializer() {
return this.fieldDeserializer;
}
示例15: setFieldDeserializer
import com.alibaba.fastjson.parser.deserializer.FieldDeserializer; //导入依赖的package包/类
public void setFieldDeserializer(FieldDeserializer fieldDeserializer) {
this.fieldDeserializer = fieldDeserializer;
}