• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

Java FieldDeserializer类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了Java中com.alibaba.fastjson.parser.deserializer.FieldDeserializer的典型用法代码示例。如果您正苦于以下问题:Java FieldDeserializer类的具体用法?Java FieldDeserializer怎么用?Java FieldDeserializer使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。



FieldDeserializer类属于com.alibaba.fastjson.parser.deserializer包,在下文中一共展示了FieldDeserializer类的18个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的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


示例16: getFieldDeserializer

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


示例17: parseObject

import com.alibaba.fastjson.parser.deserializer.FieldDeserializer; //导入依赖的package包/类
public void parseObject(Object object) {
    Class<?> clazz = object.getClass();
    Map<String, FieldDeserializer> setters = config.getFieldDeserializers(clazz);

    if (lexer.token() != JSONToken.LBRACE && lexer.token() != JSONToken.COMMA) {
        throw new JSONException("syntax error, expect {, actual " + lexer.tokenName());
    }

    for (;;) {
        // lexer.scanSymbol
        String key = lexer.scanSymbol(symbolTable);

        if (key == null) {
            if (lexer.token() == JSONToken.RBRACE) {
                lexer.nextToken(JSONToken.COMMA);
                break;
            }
            if (lexer.token() == JSONToken.COMMA) {
                if (isEnabled(Feature.AllowArbitraryCommas)) {
                    continue;
                }
            }
        }

        FieldDeserializer fieldDeser = setters.get(key);
        if (fieldDeser == null) {
            if (!isEnabled(Feature.IgnoreNotMatch)) {
                throw new JSONException("setter not found, class " + clazz.getName() + ", property " + key);
            }

            lexer.nextTokenWithColon();
            parse(); // skip

            if (lexer.token() == JSONToken.RBRACE) {
                lexer.nextToken();
                return;
            }

            continue;
        } else {
            Class<?> fieldClass = fieldDeser.getFieldClass();
            Type fieldType = fieldDeser.getFieldType();
            Object fieldValue;
            if (fieldClass == int.class) {
                lexer.nextTokenWithColon(JSONToken.LITERAL_INT);
                fieldValue = IntegerCodec.instance.deserialze(this, fieldType, null);
            } else if (fieldClass == String.class) {
                lexer.nextTokenWithColon(JSONToken.LITERAL_STRING);
                fieldValue = StringCodec.deserialze(this);
            } else if (fieldClass == long.class) {
                lexer.nextTokenWithColon(JSONToken.LITERAL_INT);
                fieldValue = LongCodec.instance.deserialze(this, fieldType, null);
            } else {
                ObjectDeserializer fieldValueDeserializer = config.getDeserializer(fieldClass, fieldType);

                lexer.nextTokenWithColon(fieldValueDeserializer.getFastMatchToken());
                fieldValue = fieldValueDeserializer.deserialze(this, fieldType, null);
            }

            fieldDeser.setValue(object, fieldValue);
        }

        if (lexer.token() == JSONToken.COMMA) {
            continue;
        }

        if (lexer.token() == JSONToken.RBRACE) {
            lexer.nextToken(JSONToken.COMMA);
            return;
        }
    }
}
 
开发者ID:liufeiit,项目名称:itmarry,代码行数:73,代码来源:DefaultJSONParser.java


示例18: createFieldDeserializer

import com.alibaba.fastjson.parser.deserializer.FieldDeserializer; //导入依赖的package包/类
public FieldDeserializer createFieldDeserializer(ParserConfig mapping, Class<?> clazz, FieldInfo fieldInfo) {
    return createFieldDeserializerWithoutASM(mapping, clazz, fieldInfo);
}
 
开发者ID:baogongtc,项目名称:android_http_demo,代码行数:4,代码来源:ParserConfig.java



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
Java ManagedEndpointFactory类代码示例发布时间:2022-05-23
下一篇:
Java Marker类代码示例发布时间:2022-05-23
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap