org.codehaus.jackson.map.JsonSerializer.unwrappingSerializer()方法的使用及代码示例

x33g5p2x  于2022-01-22 转载在 其他  
字(5.2k)|赞(0)|评价(0)|浏览(126)

本文整理了Java中org.codehaus.jackson.map.JsonSerializer.unwrappingSerializer()方法的一些代码示例,展示了JsonSerializer.unwrappingSerializer()的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。JsonSerializer.unwrappingSerializer()方法的具体详情如下:
包路径:org.codehaus.jackson.map.JsonSerializer
类名称:JsonSerializer
方法名:unwrappingSerializer

JsonSerializer.unwrappingSerializer介绍

[英]Method that will return serializer instance that produces "unwrapped" serialization, if applicable for type being serialized (which is the case for some serializers that produce JSON Objects as output). If no unwrapped serializer can be constructed, will simply return serializer as-is.

Default implementation just returns serializer as-is, indicating that no unwrapped variant exists
[中]方法,该方法将返回生成“unwrapped”序列化的序列化程序实例(如果适用于正在序列化的类型)(对于某些生成JSON对象作为输出的序列化程序就是这种情况)。如果无法构造未包装的序列化程序,则只需按原样返回序列化程序。
默认实现只是按原样返回序列化程序,表示不存在任何未包装的变量

代码示例

代码示例来源:origin: org.codehaus.jackson/jackson-mapper-asl

@Override
public BeanPropertyWriter withSerializer(JsonSerializer<Object> ser)
{
  if (getClass() != UnwrappingBeanPropertyWriter.class) {
    throw new IllegalStateException("UnwrappingBeanPropertyWriter sub-class does not override 'withSerializer()'; needs to!");
  }
  // better try to create unwrapping instance
  if (!ser.isUnwrappingSerializer()) {
    ser = ser.unwrappingSerializer();
  }
  return new UnwrappingBeanPropertyWriter(this, ser);
}

代码示例来源:origin: org.codehaus.jackson/jackson-mapper-asl

@Override
  protected JsonSerializer<Object> _findAndAddDynamic(PropertySerializerMap map,
      Class<?> type, SerializerProvider provider) throws JsonMappingException
  {
    JsonSerializer<Object> serializer;
    if (_nonTrivialBaseType != null) {
      JavaType subtype = provider.constructSpecializedType(_nonTrivialBaseType, type);
      serializer = provider.findValueSerializer(subtype, this);
    } else {
      serializer = provider.findValueSerializer(type, this);
    }
    if (!serializer.isUnwrappingSerializer()) {
      serializer = serializer.unwrappingSerializer();
    }
    _dynamicSerializers = _dynamicSerializers.newWith(type, serializer);
    return serializer;
  }
}

代码示例来源:origin: camunda/camunda-bpm-platform

@Override
public BeanPropertyWriter withSerializer(JsonSerializer<Object> ser)
{
  if (getClass() != UnwrappingBeanPropertyWriter.class) {
    throw new IllegalStateException("UnwrappingBeanPropertyWriter sub-class does not override 'withSerializer()'; needs to!");
  }
  // better try to create unwrapping instance
  if (!ser.isUnwrappingSerializer()) {
    ser = ser.unwrappingSerializer();
  }
  return new UnwrappingBeanPropertyWriter(this, ser);
}

代码示例来源:origin: camunda/camunda-bpm-platform

@Override
  protected JsonSerializer<Object> _findAndAddDynamic(PropertySerializerMap map,
      Class<?> type, SerializerProvider provider) throws JsonMappingException
  {
    JsonSerializer<Object> serializer;
    if (_nonTrivialBaseType != null) {
      JavaType subtype = provider.constructSpecializedType(_nonTrivialBaseType, type);
      serializer = provider.findValueSerializer(subtype, this);
    } else {
      serializer = provider.findValueSerializer(type, this);
    }
    if (!serializer.isUnwrappingSerializer()) {
      serializer = serializer.unwrappingSerializer();
    }
    _dynamicSerializers = _dynamicSerializers.newWith(type, serializer);
    return serializer;
  }
}

代码示例来源:origin: org.codehaus.jackson/jackson-mapper-lgpl

@Override
public BeanPropertyWriter withSerializer(JsonSerializer<Object> ser)
{
  if (getClass() != UnwrappingBeanPropertyWriter.class) {
    throw new IllegalStateException("UnwrappingBeanPropertyWriter sub-class does not override 'withSerializer()'; needs to!");
  }
  // better try to create unwrapping instance
  if (!ser.isUnwrappingSerializer()) {
    ser = ser.unwrappingSerializer();
  }
  return new UnwrappingBeanPropertyWriter(this, ser);
}

代码示例来源:origin: ovea-deprecated/jetty-session-redis

@Override
public BeanPropertyWriter withSerializer(JsonSerializer<Object> ser)
{
  if (getClass() != UnwrappingBeanPropertyWriter.class) {
    throw new IllegalStateException("UnwrappingBeanPropertyWriter sub-class does not override 'withSerializer()'; needs to!");
  }
  // better try to create unwrapping instance
  if (!ser.isUnwrappingSerializer()) {
    ser = ser.unwrappingSerializer();
  }
  return new UnwrappingBeanPropertyWriter(this, ser);
}

代码示例来源:origin: org.codehaus.jackson/jackson-mapper-lgpl

@Override
  protected JsonSerializer<Object> _findAndAddDynamic(PropertySerializerMap map,
      Class<?> type, SerializerProvider provider) throws JsonMappingException
  {
    JsonSerializer<Object> serializer;
    if (_nonTrivialBaseType != null) {
      JavaType subtype = provider.constructSpecializedType(_nonTrivialBaseType, type);
      serializer = provider.findValueSerializer(subtype, this);
    } else {
      serializer = provider.findValueSerializer(type, this);
    }
    if (!serializer.isUnwrappingSerializer()) {
      serializer = serializer.unwrappingSerializer();
    }
    _dynamicSerializers = _dynamicSerializers.newWith(type, serializer);
    return serializer;
  }
}

代码示例来源:origin: ovea-deprecated/jetty-session-redis

@Override
  protected JsonSerializer<Object> _findAndAddDynamic(PropertySerializerMap map,
      Class<?> type, SerializerProvider provider) throws JsonMappingException
  {
    JsonSerializer<Object> serializer;
    if (_nonTrivialBaseType != null) {
      JavaType t = _nonTrivialBaseType.forcedNarrowBy(type);
      serializer = provider.findValueSerializer(t, this);
    } else {
      serializer = provider.findValueSerializer(type, this);
    }
    if (!serializer.isUnwrappingSerializer()) {
      serializer = serializer.unwrappingSerializer();
    }
    _dynamicSerializers = _dynamicSerializers.newWith(type, serializer);
    return serializer;
  }
}

相关文章