com.fasterxml.jackson.databind.ser.ContextualSerializer源码实例Demo

类com.fasterxml.jackson.databind.ser.ContextualSerializer源码实例Demo

下面列出了com.fasterxml.jackson.databind.ser.ContextualSerializer 类实例代码,或者点击链接到github查看源代码,也可以在右侧发表评论。

源代码1 项目: lams   文件: StdDelegatingSerializer.java
@Override
public JsonSerializer<?> createContextual(SerializerProvider provider, BeanProperty property)
    throws JsonMappingException
{
    JsonSerializer<?> delSer = _delegateSerializer;
    JavaType delegateType = _delegateType;

    if (delSer == null) {
        // Otherwise, need to locate serializer to delegate to. For that we need type information...
        if (delegateType == null) {
            delegateType = _converter.getOutputType(provider.getTypeFactory());
        }
        // 02-Apr-2015, tatu: For "dynamic case", where type is only specified as
        //    java.lang.Object (or missing generic), [databind#731]
        if (!delegateType.isJavaLangObject()) {
            delSer = provider.findValueSerializer(delegateType);
        }
    }
    if (delSer instanceof ContextualSerializer) {
        delSer = provider.handleSecondaryContextualization(delSer, property);
    }
    if (delSer == _delegateSerializer && delegateType == _delegateType) {
        return this;
    }
    return withDelegate(_converter, delegateType, delSer);
}
 
源代码2 项目: lams   文件: TypeWrappedSerializer.java
@Override // since 2.9
public JsonSerializer<?> createContextual(SerializerProvider provider, BeanProperty property)
    throws JsonMappingException
{
    // 13-Mar-2017, tatu: Should we call `TypeSerializer.forProperty()`?
    JsonSerializer<?> ser = _serializer;
    if (ser instanceof ContextualSerializer) {
        ser = provider.handleSecondaryContextualization(ser, property);
    }
    if (ser == _serializer) {
        return this;
    }
    return new TypeWrappedSerializer(_typeSerializer, ser);
}
 
源代码3 项目: endpoints-java   文件: ObjectMapperUtil.java
@Override
public JsonSerializer<?> createContextual(SerializerProvider provider, BeanProperty property)
    throws JsonMappingException {
  if (delegate instanceof ContextualSerializer) {
    return new DeepEmptyCheckingSerializer<>(
        ((ContextualSerializer) delegate).createContextual(provider, property));
  }
  return this;
}
 
源代码4 项目: emodb   文件: LazyJsonModule.java
/**
 * Override to preserve the delegating behavior when a contextualized serializer is created.
 */
@Override
public JsonSerializer<?> createContextual(SerializerProvider prov, BeanProperty property)
        throws JsonMappingException {
    if (_delegateSerializer instanceof ContextualSerializer) {
        JsonSerializer<?> contextualDelegate = ((ContextualSerializer) _delegateSerializer).createContextual(prov, property);
        // Check for different instance
        if (contextualDelegate != _delegateSerializer) {
            return new DelegatingMapSerializer(contextualDelegate);
        }
    }
    return this;
}
 
源代码评论
动弹
沙发等你来抢
 类方法
 同包方法