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


Java StdKeySerializers类代码示例

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


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

示例1: findKeySerializer

import com.fasterxml.jackson.databind.ser.std.StdKeySerializers; //导入依赖的package包/类
/**
 * Method called to get the serializer to use for serializing
 * non-null Map keys. Separation from regular
 * {@link #findValueSerializer} method is because actual write
 * method must be different (@link JsonGenerator#writeFieldName};
 * but also since behavior for some key types may differ.
 *<p>
 * Note that the serializer itself can be called with instances
 * of any Java object, but not nulls.
 */
public JsonSerializer<Object> findKeySerializer(JavaType keyType,
        BeanProperty property)
    throws JsonMappingException
{
    JsonSerializer<Object> ser = _serializerFactory.createKeySerializer(_config, keyType);

    // First things first: maybe there are registered custom implementations
    // if not, use default one:
    if (ser == null) {
        if (_keySerializer == null) {
            ser = StdKeySerializers.getStdKeySerializer(keyType);
        } else {
            ser = _keySerializer;
        }
    }
    // 25-Feb-2011, tatu: As per [JACKSON-519], need to ensure contextuality works here, too
    return _handleContextualResolvable(ser, property);
}
 
开发者ID:joyplus,项目名称:joyplus-tv,代码行数:29,代码来源:SerializerProvider.java

示例2: createKeySerializer

import com.fasterxml.jackson.databind.ser.std.StdKeySerializers; //导入依赖的package包/类
public JsonSerializer<Object> createKeySerializer(SerializationConfig paramSerializationConfig, JavaType paramJavaType, JsonSerializer<Object> paramJsonSerializer)
{
  BeanDescription localBeanDescription = paramSerializationConfig.introspectClassAnnotations(paramJavaType.getRawClass());
  boolean bool = this._factoryConfig.hasKeySerializers();
  Object localObject = null;
  if (bool)
  {
    Iterator localIterator2 = this._factoryConfig.keySerializers().iterator();
    JsonSerializer localJsonSerializer;
    do
    {
      if (!localIterator2.hasNext())
        break;
      localJsonSerializer = ((Serializers)localIterator2.next()).findSerializer(paramSerializationConfig, paramJavaType, localBeanDescription);
      localObject = localJsonSerializer;
    }
    while (localJsonSerializer == null);
  }
  if (localObject == null)
  {
    localObject = paramJsonSerializer;
    if (paramJsonSerializer == null)
      localObject = StdKeySerializers.getStdKeySerializer(paramJavaType);
  }
  if (this._factoryConfig.hasSerializerModifiers())
  {
    Iterator localIterator1 = this._factoryConfig.serializerModifiers().iterator();
    while (localIterator1.hasNext())
      localObject = ((BeanSerializerModifier)localIterator1.next()).modifyKeySerializer(paramSerializationConfig, paramJavaType, localBeanDescription, (JsonSerializer)localObject);
  }
  return localObject;
}
 
开发者ID:mmmsplay10,项目名称:QuizUpWinner,代码行数:33,代码来源:BasicSerializerFactory.java


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