Skip to content

Commit

Permalink
Bit of additional cleanup for 2.5, #580
Browse files Browse the repository at this point in the history
  • Loading branch information
cowtowncoder committed Oct 15, 2014
1 parent 440aff0 commit ef5c5d3
Show file tree
Hide file tree
Showing 5 changed files with 15 additions and 16 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -516,6 +516,7 @@ public void resolve(DeserializationContext ctxt)
}
JsonDeserializer<Object> dd = findDeserializer(ctxt, delegateType, property);
if (td != null) {
td = td.forProperty(property);
dd = new TypeWrappedDeserializer(td, dd);
}
_delegateDeserializer = dd;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,7 @@
import java.io.IOException;

import com.fasterxml.jackson.core.JsonParser;
import com.fasterxml.jackson.core.JsonProcessingException;
import com.fasterxml.jackson.databind.DeserializationContext;
import com.fasterxml.jackson.databind.JsonDeserializer;
import com.fasterxml.jackson.databind.*;
import com.fasterxml.jackson.databind.jsontype.TypeDeserializer;

/**
Expand All @@ -18,15 +16,19 @@
*/
public final class TypeWrappedDeserializer
extends JsonDeserializer<Object>
implements java.io.Serializable // since 2.5
{
final TypeDeserializer _typeDeserializer;
final JsonDeserializer<Object> _deserializer;
private static final long serialVersionUID = 1L;

public TypeWrappedDeserializer(TypeDeserializer typeDeser, JsonDeserializer<Object> deser)
final protected TypeDeserializer _typeDeserializer;
final protected JsonDeserializer<Object> _deserializer;

@SuppressWarnings("unchecked")
public TypeWrappedDeserializer(TypeDeserializer typeDeser, JsonDeserializer<?> deser)
{
super();
_typeDeserializer = typeDeser;
_deserializer = deser;
_deserializer = (JsonDeserializer<Object>) deser;
}

@Override
Expand All @@ -35,25 +37,22 @@ public Class<?> handledType() {
}

@Override
public Object deserialize(JsonParser jp, DeserializationContext ctxt)
throws IOException, JsonProcessingException
public Object deserialize(JsonParser jp, DeserializationContext ctxt) throws IOException
{
return _deserializer.deserializeWithType(jp, ctxt, _typeDeserializer);
}

@Override
public Object deserializeWithType(JsonParser jp, DeserializationContext ctxt,
TypeDeserializer typeDeserializer)
throws IOException, JsonProcessingException
TypeDeserializer typeDeserializer) throws IOException
{
// should never happen? (if it can, could call on that object)
throw new IllegalStateException("Type-wrapped deserializer's deserializeWithType should never get called");
}

@Override
public Object deserialize(JsonParser jp, DeserializationContext ctxt,
Object intoValue)
throws IOException, JsonProcessingException
Object intoValue) throws IOException
{
/* 01-Mar-2013, tatu: Hmmh. Tough call as to what to do... need
* to delegate, but will this work reliably? Let's just hope so:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ public class MapDeserializer
extends ContainerDeserializerBase<Map<Object,Object>>
implements ContextualDeserializer, ResolvableDeserializer
{
private static final long serialVersionUID = -3378654289961736240L;
private static final long serialVersionUID = 1L;

// // Configuration: typing, deserializers

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@

import java.io.IOException;

import com.fasterxml.jackson.core.JsonProcessingException;
import com.fasterxml.jackson.databind.*;
import com.fasterxml.jackson.databind.annotation.JacksonStdImpl;
import com.fasterxml.jackson.databind.deser.*;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package com.fasterxml.jackson.failing;
package com.fasterxml.jackson.databind.creators;

import com.fasterxml.jackson.annotation.JsonCreator;
import com.fasterxml.jackson.annotation.JacksonInject;
Expand Down

0 comments on commit ef5c5d3

Please sign in to comment.