本文整理汇总了Java中org.codehaus.jackson.map.JsonSerializableWithType类的典型用法代码示例。如果您正苦于以下问题:Java JsonSerializableWithType类的具体用法?Java JsonSerializableWithType怎么用?Java JsonSerializableWithType使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
JsonSerializableWithType类属于org.codehaus.jackson.map包,在下文中一共展示了JsonSerializableWithType类的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: serializeWithType
import org.codehaus.jackson.map.JsonSerializableWithType; //导入依赖的package包/类
public final void serializeWithType(JsonSerializable paramJsonSerializable, JsonGenerator paramJsonGenerator, SerializerProvider paramSerializerProvider, TypeSerializer paramTypeSerializer)
throws IOException, JsonGenerationException
{
if ((paramJsonSerializable instanceof JsonSerializableWithType))
{
((JsonSerializableWithType)paramJsonSerializable).serializeWithType(paramJsonGenerator, paramSerializerProvider, paramTypeSerializer);
return;
}
serialize(paramJsonSerializable, paramJsonGenerator, paramSerializerProvider);
}
示例2: findSerializerByPrimaryType
import org.codehaus.jackson.map.JsonSerializableWithType; //导入依赖的package包/类
public final JsonSerializer<?> findSerializerByPrimaryType(JavaType paramJavaType, SerializationConfig paramSerializationConfig, BasicBeanDescription paramBasicBeanDescription, BeanProperty paramBeanProperty, boolean paramBoolean)
throws JsonMappingException
{
Class localClass = paramJavaType.getRawClass();
Object localObject;
if (JsonSerializable.class.isAssignableFrom(localClass))
if (JsonSerializableWithType.class.isAssignableFrom(localClass))
localObject = StdSerializers.SerializableWithTypeSerializer.instance;
do
{
return localObject;
return StdSerializers.SerializableSerializer.instance;
AnnotatedMethod localAnnotatedMethod = paramBasicBeanDescription.findJsonValueMethod();
if (localAnnotatedMethod != null)
{
JsonSerializer localJsonSerializer = findSerializerFromAnnotation(paramSerializationConfig, localAnnotatedMethod, paramBeanProperty);
return new JsonValueSerializer(localAnnotatedMethod.getAnnotated(), localJsonSerializer, paramBeanProperty);
}
if (InetAddress.class.isAssignableFrom(localClass))
return InetAddressSerializer.instance;
if (TimeZone.class.isAssignableFrom(localClass))
return TimeZoneSerializer.instance;
localObject = this.optionalHandlers.findSerializer(paramSerializationConfig, paramJavaType);
}
while (localObject != null);
if (Number.class.isAssignableFrom(localClass))
return StdSerializers.NumberSerializer.instance;
if (Enum.class.isAssignableFrom(localClass))
return EnumSerializer.construct(localClass, paramSerializationConfig, paramBasicBeanDescription);
if (Calendar.class.isAssignableFrom(localClass))
return StdSerializers.CalendarSerializer.instance;
if (java.util.Date.class.isAssignableFrom(localClass))
return StdSerializers.UtilDateSerializer.instance;
return (JsonSerializer<?>)null;
}
示例3: serializeWithType
import org.codehaus.jackson.map.JsonSerializableWithType; //导入依赖的package包/类
public final void serializeWithType(JsonSerializable paramJsonSerializable, JsonGenerator paramJsonGenerator, SerializerProvider paramSerializerProvider, TypeSerializer paramTypeSerializer)
{
if ((paramJsonSerializable instanceof JsonSerializableWithType))
{
((JsonSerializableWithType)paramJsonSerializable).serializeWithType(paramJsonGenerator, paramSerializerProvider, paramTypeSerializer);
return;
}
serialize(paramJsonSerializable, paramJsonGenerator, paramSerializerProvider);
}
示例4: findSerializerByPrimaryType
import org.codehaus.jackson.map.JsonSerializableWithType; //导入依赖的package包/类
public final JsonSerializer<?> findSerializerByPrimaryType(JavaType paramJavaType, SerializationConfig paramSerializationConfig, BasicBeanDescription paramBasicBeanDescription, BeanProperty paramBeanProperty, boolean paramBoolean)
{
Class localClass = paramJavaType.getRawClass();
Object localObject;
if (JsonSerializable.class.isAssignableFrom(localClass))
if (JsonSerializableWithType.class.isAssignableFrom(localClass))
localObject = SerializableWithTypeSerializer.instance;
do
{
return localObject;
return SerializableSerializer.instance;
AnnotatedMethod localAnnotatedMethod = paramBasicBeanDescription.findJsonValueMethod();
if (localAnnotatedMethod != null)
{
Method localMethod = localAnnotatedMethod.getAnnotated();
if (paramSerializationConfig.isEnabled(SerializationConfig.Feature.CAN_OVERRIDE_ACCESS_MODIFIERS))
ClassUtil.checkAndFixAccess(localMethod);
return new JsonValueSerializer(localMethod, findSerializerFromAnnotation(paramSerializationConfig, localAnnotatedMethod, paramBeanProperty), paramBeanProperty);
}
if (InetAddress.class.isAssignableFrom(localClass))
return InetAddressSerializer.instance;
if (TimeZone.class.isAssignableFrom(localClass))
return TimeZoneSerializer.instance;
localObject = this.optionalHandlers.findSerializer(paramSerializationConfig, paramJavaType);
}
while (localObject != null);
if (Number.class.isAssignableFrom(localClass))
return StdSerializers.NumberSerializer.instance;
if (Enum.class.isAssignableFrom(localClass))
return EnumSerializer.construct(localClass, paramSerializationConfig, paramBasicBeanDescription);
if (Calendar.class.isAssignableFrom(localClass))
return CalendarSerializer.instance;
if (java.util.Date.class.isAssignableFrom(localClass))
return DateSerializer.instance;
return null;
}
示例5: serialize
import org.codehaus.jackson.map.JsonSerializableWithType; //导入依赖的package包/类
public void serialize(JsonSerializableWithType paramJsonSerializableWithType, JsonGenerator paramJsonGenerator, SerializerProvider paramSerializerProvider)
throws IOException, JsonGenerationException
{
paramJsonSerializableWithType.serialize(paramJsonGenerator, paramSerializerProvider);
}
示例6: SerializableWithTypeSerializer
import org.codehaus.jackson.map.JsonSerializableWithType; //导入依赖的package包/类
protected SerializableWithTypeSerializer()
{
super(JsonSerializableWithType.class);
}
示例7: serialize
import org.codehaus.jackson.map.JsonSerializableWithType; //导入依赖的package包/类
public void serialize(JsonSerializableWithType paramJsonSerializableWithType, JsonGenerator paramJsonGenerator, SerializerProvider paramSerializerProvider)
{
paramJsonSerializableWithType.serialize(paramJsonGenerator, paramSerializerProvider);
}
示例8: serializeWithType
import org.codehaus.jackson.map.JsonSerializableWithType; //导入依赖的package包/类
public final void serializeWithType(JsonSerializableWithType paramJsonSerializableWithType, JsonGenerator paramJsonGenerator, SerializerProvider paramSerializerProvider, TypeSerializer paramTypeSerializer)
{
paramJsonSerializableWithType.serializeWithType(paramJsonGenerator, paramSerializerProvider, paramTypeSerializer);
}