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

Java JavaBeanDeserializer类代码示例

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

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



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

示例1: getFieldDeserializers

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


示例2: getFieldDeserializers

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


示例3: getFieldDeserializers

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


示例4: createJavaBeanDeserializer

import com.alibaba.fastjson.parser.deserializer.JavaBeanDeserializer; //导入依赖的package包/类
public ObjectDeserializer createJavaBeanDeserializer(Class<?> clazz, Type type) {
    if (clazz == Class.class) {
        return this.defaultSerializer;
    }

    return new JavaBeanDeserializer(this, clazz, type);
}
 
开发者ID:baogongtc,项目名称:android_http_demo,代码行数:8,代码来源:ParserConfig.java


示例5: parseField

import com.alibaba.fastjson.parser.deserializer.JavaBeanDeserializer; //导入依赖的package包/类
@Override
public void parseField(DefaultJSONParser parser, Object object, Type objectType, Map<String, Object> fieldValues) {
    if (fieldValueDeserilizer == null) {
        getFieldValueDeserilizer(parser.getConfig());
    }

    Type fieldType = fieldInfo.fieldType;
    if (objectType instanceof ParameterizedType) {
        ParseContext objContext = parser.getContext();
        objContext.type = objectType;
        fieldType = FieldInfo.getFieldType(this.clazz, objectType, fieldType);
    }

    // ContextObjectDeserializer
    Object value;
    if (fieldValueDeserilizer instanceof JavaBeanDeserializer) {
        JavaBeanDeserializer javaBeanDeser = (JavaBeanDeserializer) fieldValueDeserilizer;
        value = javaBeanDeser.deserialze(parser, fieldType, fieldInfo.name, fieldInfo.parserFeatures);
    } else {
        if (this.fieldInfo.format != null && fieldValueDeserilizer instanceof ContextObjectDeserializer) {
            value = ((ContextObjectDeserializer) fieldValueDeserilizer) //
                    .deserialze(parser, fieldType,
                            fieldInfo.name,
                            fieldInfo.format,
                            fieldInfo.parserFeatures);
        } else {
            value = fieldValueDeserilizer.deserialze(parser, fieldType, fieldInfo.name);
        }
    }
    if (parser.getResolveStatus() == DefaultJSONParser.NeedToResolve) {
        DefaultJSONParser.ResolveTask task = parser.getLastResolveTask();
        task.fieldDeserializer = this;
        task.ownerContext = parser.getContext();
        parser.setResolveStatus(DefaultJSONParser.NONE);
    } else {
        if (object == null) {
            fieldValues.put(fieldInfo.name, value);
        } else {
            setValue(object, value);
        }
    }
}
 
开发者ID:weiwenqiang,项目名称:GitHub,代码行数:43,代码来源:DefaultFieldDeserializerBug569.java


示例6: test_for_issue

import com.alibaba.fastjson.parser.deserializer.JavaBeanDeserializer; //导入依赖的package包/类
public void test_for_issue() throws Exception {
    ParserConfig config = new ParserConfig();
    ObjectDeserializer deser = config.getDeserializer(Model.class);
    Assert.assertEquals(JavaBeanDeserializer.class, deser.getClass());
}
 
开发者ID:weiwenqiang,项目名称:GitHub,代码行数:6,代码来源:Bug_for_issue_372.java


示例7: createJavaBeanDeserializer

import com.alibaba.fastjson.parser.deserializer.JavaBeanDeserializer; //导入依赖的package包/类
public ObjectDeserializer createJavaBeanDeserializer(Class<?> clazz, Type type) {
    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 (clazz.getTypeParameters().length != 0) {
        asmEnable = false;
    }
    if (asmEnable && this.asmFactory != null && this.asmFactory.isExternalClass(clazz)) {
        asmEnable = false;
    }
    if (asmEnable) {
        asmEnable = ASMUtils.checkName(clazz.getName());
    }
    if (asmEnable) {
        if (clazz.isInterface()) {
            asmEnable = false;
        }
        DeserializeBeanInfo beanInfo = DeserializeBeanInfo.computeSetters(clazz, type);
        if (beanInfo.getFieldList().size() > 200) {
            asmEnable = false;
        }
        if (beanInfo.getDefaultConstructor() == null && !clazz.isInterface()) {
            asmEnable = false;
        }
        for (FieldInfo fieldInfo : beanInfo.getFieldList()) {
            if (fieldInfo.isGetOnly()) {
                asmEnable = false;
                break;
            }
            Class<?> fieldClass = fieldInfo.getFieldClass();
            if (!Modifier.isPublic(fieldClass.getModifiers())) {
                asmEnable = false;
                break;
            }
            if (fieldClass.isMemberClass() && !Modifier.isStatic(fieldClass.getModifiers())) {
                asmEnable = false;
            }
            if (!ASMUtils.checkName(fieldInfo.getMember().getName())) {
                asmEnable = false;
            }
        }
    }
    if (asmEnable && clazz.isMemberClass() && !Modifier.isStatic(clazz.getModifiers())) {
        asmEnable = false;
    }
    if (!asmEnable) {
        return new JavaBeanDeserializer(this, clazz, type);
    }
    try {
        return this.asmFactory.createJavaBeanDeserializer(this, clazz, type);
    } catch (NoSuchMethodException e) {
        return new JavaBeanDeserializer(this, clazz, type);
    } catch (ASMException e2) {
        return new JavaBeanDeserializer(this, clazz, type);
    } catch (Exception e3) {
        throw new JSONException("create asm deserializer error, " + clazz.getName(), e3);
    }
}
 
开发者ID:JackChan1999,项目名称:boohee_v5.6,代码行数:70,代码来源:ParserConfig.java


示例8: fastJsonGenericHttpMessageConverter

import com.alibaba.fastjson.parser.deserializer.JavaBeanDeserializer; //导入依赖的package包/类
@Bean
@Primary
@ConfigurationProperties(prefix = "fastjson")
public FastJsonGenericHttpMessageConverter fastJsonGenericHttpMessageConverter(EntityFactory entityFactory) {
    JSON.DEFAULT_PARSER_FEATURE |= Feature.DisableFieldSmartMatch.getMask();
    FastJsonGenericHttpMessageConverter converter = new FastJsonGenericHttpMessageConverter();
    converter.setFeatures(
            SerializerFeature.WriteNullListAsEmpty,
            SerializerFeature.WriteNullNumberAsZero,
            SerializerFeature.WriteNullBooleanAsFalse
    );
    converter.setConverters(converters);
    ParserConfig.global = new ParserConfig() {
        @Override
        public ObjectDeserializer getDeserializer(Type type) {
            ObjectDeserializer derializer = getDeserializers().get(type);
            if (derializer != null) {
                return derializer;
            }
            if (type instanceof Class) {
                Class classType = ((Class) type);
                if (classType.isEnum()) {
                    return super.getDeserializer(type);
                }
                checkAutoType(type.getTypeName(), ((Class) type));
                if (Modifier.isAbstract(classType.getModifiers()) || Modifier.isInterface(classType.getModifiers())) {
                    Class realType;
                    if (entityFactory != null && (realType = entityFactory.getInstanceType(classType)) != null) {
                        return new JavaBeanDeserializer(this, realType, type);
                    }
                } else {
                    return new JavaBeanDeserializer(this, classType);
                }
            }

            return super.getDeserializer(type);
        }
    };

    //fastjson.parser.autoTypeAccept
    ParserConfig.global.addAccept("org.hswebframework.web.entity.");
    ParserConfig.global.addDeny("org.hswebframework.ezorm.core.param.SqlTerm");
    return converter;
}
 
开发者ID:hs-web,项目名称:hsweb-framework,代码行数:45,代码来源:HswebAutoConfiguration.java


示例9: createJavaBeanDeserializer

import com.alibaba.fastjson.parser.deserializer.JavaBeanDeserializer; //导入依赖的package包/类
public ObjectDeserializer createJavaBeanDeserializer(Class<?> clazz, Type type) {
    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 (clazz.getTypeParameters().length != 0) {
        asmEnable = false;
    }

    if (asmFactory.isExternalClass(clazz)) {
        asmEnable = false;
    }

    if (asmEnable) {
        if (clazz.isInterface()) {
            asmEnable = false;
        }
        DeserializeBeanInfo beanInfo = DeserializeBeanInfo.computeSetters(clazz, type);
        if (beanInfo.getFieldList().size() > 200) {
            asmEnable = false;
        }

        Constructor<?> defaultConstructor = beanInfo.getDefaultConstructor();
        if (defaultConstructor == null && !clazz.isInterface()) {
            asmEnable = false;
        }

        for (FieldInfo fieldInfo : beanInfo.getFieldList()) {
            if (fieldInfo.isGetOnly()) {
                asmEnable = false;
                break;
            }

            Class<?> fieldClass = fieldInfo.getFieldClass();
            if (!Modifier.isPublic(fieldClass.getModifiers())) {
                asmEnable = false;
                break;
            }

            if (fieldClass.isMemberClass() && !Modifier.isStatic(fieldClass.getModifiers())) {
                asmEnable = false;
            }
        }
    }

    if (asmEnable) {
        if (clazz.isMemberClass() && !Modifier.isStatic(clazz.getModifiers())) {
            asmEnable = false;
        }
    }

    if (!asmEnable) {
        return new JavaBeanDeserializer(this, clazz, type);
    }

    try {
        return asmFactory.createJavaBeanDeserializer(this, clazz, type);
        // } catch (VerifyError e) {
        // e.printStackTrace();
        // return new JavaBeanDeserializer(this, clazz, type);
    } catch (NoSuchMethodException ex) {
        return new JavaBeanDeserializer(this, clazz, type);
    } catch (ASMException asmError) {
        return new JavaBeanDeserializer(this, clazz, type);
    } catch (Exception e) {
        throw new JSONException("create asm deserializer error, " + clazz.getName(), e);
    }
}
 
开发者ID:liufeiit,项目名称:itmarry,代码行数:82,代码来源:ParserConfig.java



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


鲜花

握手

雷人

路过

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

请发表评论

全部评论

专题导读
上一篇:
Java Messages类代码示例发布时间:2022-05-23
下一篇:
Java Options类代码示例发布时间: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