當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。