当前位置: 首页>>代码示例>>Java>>正文


Java FieldDeserializer类代码示例

本文整理汇总了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);
}
 
开发者ID:JackChan1999,项目名称:boohee_v5.6,代码行数:20,代码来源:ParserConfig.java

示例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);
            }
        }
    }
}
 
开发者ID:JackChan1999,项目名称:boohee_v5.6,代码行数:24,代码来源:DefaultJSONParser.java

示例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);
}
 
开发者ID:uavorg,项目名称:uavstack,代码行数:26,代码来源:ParserConfig.java

示例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();
    }
}
 
开发者ID:xiaoshutong,项目名称:AndroidNio,代码行数:10,代码来源:ParserConfig.java

示例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);
    }
}
 
开发者ID:JackChan1999,项目名称:boohee_v5.6,代码行数:31,代码来源:ParserConfig.java

示例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();
}
 
开发者ID:JackChan1999,项目名称:boohee_v5.6,代码行数:11,代码来源:ParserConfig.java

示例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);
}
 
开发者ID:uavorg,项目名称:uavstack,代码行数:40,代码来源:ParserConfig.java

示例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();
    }
}
 
开发者ID:uavorg,项目名称:uavstack,代码行数:12,代码来源:ParserConfig.java

示例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);
    }
}
 
开发者ID:uavorg,项目名称:uavstack,代码行数:30,代码来源:DefaultJSONParser.java

示例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);
}
 
开发者ID:liufeiit,项目名称:itmarry,代码行数:40,代码来源:ParserConfig.java

示例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);
    }
}
 
开发者ID:liufeiit,项目名称:itmarry,代码行数:30,代码来源:JSON.java

示例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);
}
 
开发者ID:baogongtc,项目名称:android_http_demo,代码行数:34,代码来源:ParserConfig.java

示例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;
}
 
开发者ID:baogongtc,项目名称:android_http_demo,代码行数:28,代码来源:JSON.java

示例14: getFieldDeserializer

import com.alibaba.fastjson.parser.deserializer.FieldDeserializer; //导入依赖的package包/类
public FieldDeserializer getFieldDeserializer() {
    return this.fieldDeserializer;
}
 
开发者ID:JackChan1999,项目名称:boohee_v5.6,代码行数:4,代码来源:DefaultJSONParser.java

示例15: setFieldDeserializer

import com.alibaba.fastjson.parser.deserializer.FieldDeserializer; //导入依赖的package包/类
public void setFieldDeserializer(FieldDeserializer fieldDeserializer) {
    this.fieldDeserializer = fieldDeserializer;
}
 
开发者ID:JackChan1999,项目名称:boohee_v5.6,代码行数:4,代码来源:DefaultJSONParser.java


注:本文中的com.alibaba.fastjson.parser.deserializer.FieldDeserializer类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。