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

Java BeanSerializerFactory类代码示例

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

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



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

示例1: filterInputClasses

import org.codehaus.jackson.map.ser.BeanSerializerFactory; //导入依赖的package包/类
private Set<Class<?>> filterInputClasses(Set<Class<?>> referencedClasses) {
    Set<Class<?>> typesToUse = Sets.newHashSet();
    for (Class<?> beanClass : referencedClasses) {
        if (beanClass.isEnum()) {
            typesToUse.add(beanClass);
            continue;
        }
        if (beanClass.equals(void.class)) {
            continue;
        }
        if (beanClass instanceof Class && beanClass.isEnum()) {
            typesToUse.add(beanClass);
            continue;
        }
        if (beanClass == URI.class) {
            continue;
        }

        // Classes directly passed in to typescript-generator need to be directly serializable, so filter out the ones that serializers
        // exist for.
        SerializationConfig serializationConfig = OBJECT_MAPPER.getSerializationConfig();
        final JavaType simpleType = OBJECT_MAPPER.constructType(beanClass);
        try {
            final JsonSerializer<?> jsonSerializer = BeanSerializerFactory.instance.createSerializer(serializationConfig, simpleType, null);
            if (jsonSerializer == null || jsonSerializer instanceof BeanSerializer) {
                typesToUse.add(beanClass);
            }
        } catch(Exception e) {

        }
    }
    return typesToUse;
}
 
开发者ID:palantir,项目名称:typescript-service-generator,代码行数:34,代码来源:ServiceEmitter.java


示例2: StdEscapeHTMLSerializerProvider

import org.codehaus.jackson.map.ser.BeanSerializerFactory; //导入依赖的package包/类
@SuppressWarnings("unchecked")
public StdEscapeHTMLSerializerProvider(SerializationConfig serializationConfig) throws JsonMappingException {
    super(serializationConfig, new StdSerializerProvider(), BeanSerializerFactory.instance);
    JsonSerializer stringEscapeHTMLSerializer = new StringEscapeHTMLSerializer();
    _serializerCache.addAndResolveNonTypedSerializer(String.class, stringEscapeHTMLSerializer, this);
    JavaType javaType = TypeFactory.fromCanonical(String.class.getName());
    _serializerCache.addAndResolveNonTypedSerializer(javaType, stringEscapeHTMLSerializer, this);

}
 
开发者ID:krisjin,项目名称:bscl,代码行数:10,代码来源:StdEscapeHTMLSerializerProvider.java


示例3: ObjectMapper

import org.codehaus.jackson.map.ser.BeanSerializerFactory; //导入依赖的package包/类
/**
 * 
 * @param jf JsonFactory to use: if null, a new {@link MappingJsonFactory} will be constructed
 * @param sp SerializerProvider to use: if null, a {@link StdSerializerProvider} will be constructed
 * @param dp DeserializerProvider to use: if null, a {@link StdDeserializerProvider} will be constructed
 * @param sconfig Serialization configuration to use; if null, basic {@link SerializationConfig}
 * 	will be constructed
 * @param dconfig Deserialization configuration to use; if null, basic {@link DeserializationConfig}
 * 	will be constructed
 */
public ObjectMapper(JsonFactory jf,
                    SerializerProvider sp, DeserializerProvider dp,
                   SerializationConfig sconfig, DeserializationConfig dconfig)
{
    /* 02-Mar-2009, tatu: Important: we MUST default to using
     *   the mapping factory, otherwise tree serialization will
     *   have problems with POJONodes.
     * 03-Jan-2010, tatu: and obviously we also must pass 'this',
     *    to create actual linking.
     */
    _jsonFactory = (jf == null) ? new MappingJsonFactory(this) : jf;
    // visibility checker; usually default
    _visibilityChecker = STD_VISIBILITY_CHECKER;
    _serializationConfig = (sconfig != null) ? sconfig :
        new SerializationConfig(DEFAULT_INTROSPECTOR, DEFAULT_ANNOTATION_INTROSPECTOR, _visibilityChecker);
    _deserializationConfig = (dconfig != null) ? dconfig :
        new DeserializationConfig(DEFAULT_INTROSPECTOR, DEFAULT_ANNOTATION_INTROSPECTOR, _visibilityChecker);
    _serializerProvider = (sp == null) ? new StdSerializerProvider() : sp;
    _deserializerProvider = (dp == null) ? new StdDeserializerProvider() : dp;

    // Default serializer factory is stateless, can just assign
    _serializerFactory = BeanSerializerFactory.instance;

    // and use standard JsonNodeFactory initially
    _nodeFactory = JsonNodeFactory.instance;

}
 
开发者ID:r00li,项目名称:RHome,代码行数:38,代码来源:ObjectMapper.java



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


鲜花

握手

雷人

路过

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

请发表评论

全部评论

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