本文整理汇总了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);
}
示例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;
}