org.cassandraunit.shaded.org.codehaus.jackson.map.jsontype.impl.AsArrayTypeDeserializer Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of cassandra-unit-shaded Show documentation
Show all versions of cassandra-unit-shaded Show documentation
Shaded version of cassandra-unit
package org.codehaus.jackson.map.jsontype.impl;
import java.io.IOException;
import org.codehaus.jackson.*;
import org.codehaus.jackson.annotate.JsonTypeInfo.As;
import org.codehaus.jackson.map.*;
import org.codehaus.jackson.map.jsontype.TypeIdResolver;
import org.codehaus.jackson.type.JavaType;
/**
* Type deserializer used with {@link As#WRAPPER_ARRAY}
* inclusion mechanism. Simple since JSON structure used is always
* the same, regardless of structure used for actual value: wrapping
* is done using a 2-element JSON Array where type id is the first
* element, and actual object data as second element.
*
* @author tatus
*/
public class AsArrayTypeDeserializer extends TypeDeserializerBase
{
@Deprecated // since 1.9
public AsArrayTypeDeserializer(JavaType bt, TypeIdResolver idRes, BeanProperty property) {
this(bt, idRes, property, null);
}
public AsArrayTypeDeserializer(JavaType bt, TypeIdResolver idRes, BeanProperty property,
Class defaultImpl)
{
super(bt, idRes, property, defaultImpl);
}
@Override
public As getTypeInclusion() {
return As.WRAPPER_ARRAY;
}
/**
* Method called when actual object is serialized as JSON Array.
*/
@Override
public Object deserializeTypedFromArray(JsonParser jp, DeserializationContext ctxt)
throws IOException, JsonProcessingException
{
return _deserialize(jp, ctxt);
}
/**
* Method called when actual object is serialized as JSON Object
*/
@Override
public Object deserializeTypedFromObject(JsonParser jp, DeserializationContext ctxt)
throws IOException, JsonProcessingException
{
return _deserialize(jp, ctxt);
}
@Override
public Object deserializeTypedFromScalar(JsonParser jp, DeserializationContext ctxt)
throws IOException, JsonProcessingException
{
return _deserialize(jp, ctxt);
}
@Override
public Object deserializeTypedFromAny(JsonParser jp, DeserializationContext ctxt)
throws IOException, JsonProcessingException
{
return _deserialize(jp, ctxt);
}
/*
/***************************************************************
/* Internal methods
/***************************************************************
*/
/**
* Method that handles type information wrapper, locates actual
* subtype deserializer to use, and calls it to do actual
* deserialization.
*/
private final Object _deserialize(JsonParser jp, DeserializationContext ctxt)
throws IOException, JsonProcessingException
{
JsonDeserializer