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


Java DefaultFieldDeserializer类代码示例

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


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

示例1: createFieldDeserializerWithoutASM

import com.alibaba.fastjson.parser.deserializer.DefaultFieldDeserializer; //导入依赖的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: createFieldDeserializerWithoutASM

import com.alibaba.fastjson.parser.deserializer.DefaultFieldDeserializer; //导入依赖的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

示例3: createFieldDeserializerWithoutASM

import com.alibaba.fastjson.parser.deserializer.DefaultFieldDeserializer; //导入依赖的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


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