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


Java SerializerProvider.defaultSerializeNull方法代码示例

本文整理汇总了Java中com.fasterxml.jackson.databind.SerializerProvider.defaultSerializeNull方法的典型用法代码示例。如果您正苦于以下问题:Java SerializerProvider.defaultSerializeNull方法的具体用法?Java SerializerProvider.defaultSerializeNull怎么用?Java SerializerProvider.defaultSerializeNull使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在com.fasterxml.jackson.databind.SerializerProvider的用法示例。


在下文中一共展示了SerializerProvider.defaultSerializeNull方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: serializeWithType

import com.fasterxml.jackson.databind.SerializerProvider; //导入方法依赖的package包/类
@Override
public void serializeWithType(HibernateProxy value, JsonGenerator jgen,
		SerializerProvider provider, TypeSerializer typeSer)
		throws IOException, JsonProcessingException {
	Object proxiedValue = findProxied(value);
	if (proxiedValue == null) {
		provider.defaultSerializeNull(jgen);
		return;
	}
	/*
	 * This isn't exactly right, since type serializer really refers to
	 * proxy object, not value. And we really don't either know static type
	 * (necessary to know how to apply additional type info) or other
	 * things; so it's not going to work well. But... we'll do out best.
	 */
	findSerializer(provider, proxiedValue).serializeWithType(proxiedValue,
			jgen, provider, typeSer);
}
 
开发者ID:jmfgdev,项目名称:gitplex-mit,代码行数:19,代码来源:HibernateProxySerializer.java

示例2: serializeContents

import com.fasterxml.jackson.databind.SerializerProvider; //导入方法依赖的package包/类
protected void serializeContents(Collection<?> value, JsonGenerator gen, SerializerProvider provider)
        throws IOException {
    int i = 0;
    try {
        for (Object elem : value) {
            if (elem != null) {
                serializeWithMask((String) elem, gen, provider);
            } else {
                provider.defaultSerializeNull(gen);
            }
            ++i;
        }
    } catch (Exception e) {
        wrapAndThrow(provider, e, value, i);
    }
}
 
开发者ID:visionarts,项目名称:power-jambda,代码行数:17,代码来源:MaskableCollectionSerializer.java

示例3: serialize

import com.fasterxml.jackson.databind.SerializerProvider; //导入方法依赖的package包/类
@Override
public void serialize(HibernateProxy value, JsonGenerator jgen,
		SerializerProvider provider) throws IOException,
		JsonProcessingException {
	Object proxiedValue = findProxied(value);
	// TODO: figure out how to suppress nulls, if necessary? (too late for
	// that here)
	if (proxiedValue == null) {
		provider.defaultSerializeNull(jgen);
		return;
	}
	findSerializer(provider, proxiedValue).serialize(proxiedValue, jgen,
			provider);
}
 
开发者ID:jmfgdev,项目名称:gitplex-mit,代码行数:15,代码来源:HibernateProxySerializer.java

示例4: serialize

import com.fasterxml.jackson.databind.SerializerProvider; //导入方法依赖的package包/类
@Override
public void serialize(Point value, JsonGenerator jgen, SerializerProvider provider) throws IOException {
    if (value == null || value.getCoordinate() == null) {
        provider.defaultSerializeNull(jgen);

    } else {
        jgen.writeStartObject();
        jgen.writeObjectField("x", value.getX());
        jgen.writeObjectField("y", value.getY());
        jgen.writeEndObject();
    }
}
 
开发者ID:RWTH-i5-IDSG,项目名称:xsharing-services-router,代码行数:13,代码来源:PointSerializer.java


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