Skip to content

Commit

Permalink
...
Browse files Browse the repository at this point in the history
  • Loading branch information
cowtowncoder committed Apr 13, 2018
1 parent e02fbe1 commit bdbd67e
Showing 1 changed file with 13 additions and 25 deletions.
Expand Up @@ -510,7 +510,6 @@ public abstract WritableObjectId findObjectId(Object forPojo,
* accessing suitable serializer; including that of not
* finding any serializer
*/
@SuppressWarnings("unchecked")
public JsonSerializer<Object> findValueSerializer(Class<?> valueType, BeanProperty property)
throws JsonMappingException
{
Expand All @@ -534,7 +533,7 @@ public JsonSerializer<Object> findValueSerializer(Class<?> valueType, BeanProper
}
}
// at this point, resolution has occured, but not contextualization
return (JsonSerializer<Object>) handleSecondaryContextualization(ser, property);
return handleSecondaryContextualization(ser, property);
}

/**
Expand All @@ -549,7 +548,6 @@ public JsonSerializer<Object> findValueSerializer(Class<?> valueType, BeanProper
* serializer is needed: annotations of the property (or bean that contains it)
* may be checked to create contextual serializers.
*/
@SuppressWarnings("unchecked")
public JsonSerializer<Object> findValueSerializer(JavaType valueType, BeanProperty property)
throws JsonMappingException
{
Expand All @@ -568,7 +566,7 @@ public JsonSerializer<Object> findValueSerializer(JavaType valueType, BeanProper
return ser;
}
}
return (JsonSerializer<Object>) handleSecondaryContextualization(ser, property);
return handleSecondaryContextualization(ser, property);
}

/**
Expand Down Expand Up @@ -627,7 +625,6 @@ public JsonSerializer<Object> findValueSerializer(JavaType valueType)
* @param property Property that is being handled; will never be null, and its
* type has to match <code>valueType</code> parameter.
*/
@SuppressWarnings("unchecked")
public JsonSerializer<Object> findPrimaryPropertySerializer(JavaType valueType, BeanProperty property)
throws JsonMappingException
{
Expand All @@ -643,7 +640,7 @@ public JsonSerializer<Object> findPrimaryPropertySerializer(JavaType valueType,
return ser;
}
}
return (JsonSerializer<Object>) handlePrimaryContextualization(ser, property);
return handlePrimaryContextualization(ser, property);
}

/**
Expand Down Expand Up @@ -748,7 +745,9 @@ public JsonSerializer<Object> findKeySerializer(JavaType keyType, BeanProperty p
// 16-Mar-2018, tatu: Used to have "default key serializer" in 2.x; dropped to let/make
// custom code use Module interface or similar to provide key serializers
JsonSerializer<Object> ser = _serializerFactory.createKeySerializer(_config, keyType, null);
return _handleContextualResolvable(ser, property);
// _handleContextualResolvable(ser, property):
ser.resolve(this);
return handleSecondaryContextualization(ser, property);
}

public JsonSerializer<Object> findKeySerializer(Class<?> rawKeyType, BeanProperty property)
Expand Down Expand Up @@ -798,27 +797,14 @@ protected JsonSerializer<Object> _createAndCacheUntypedSerializer(JavaType type)
return ser;
}

/**
* Helper method called to resolve and contextualize given
* serializer, if and as necessary.
*/
@SuppressWarnings("unchecked")
protected JsonSerializer<Object> _handleContextualResolvable(JsonSerializer<?> ser,
BeanProperty property)
throws JsonMappingException
{
ser.resolve(this);
return (JsonSerializer<Object>) handleSecondaryContextualization(ser, property);
}

@SuppressWarnings("unchecked")
protected JsonSerializer<Object> _handleResolvable(JsonSerializer<?> ser)
throws JsonMappingException
{
ser.resolve(this);
return (JsonSerializer<Object>) ser;
}

/*
/**********************************************************************
/* Accessors for specialized serializers
Expand Down Expand Up @@ -951,14 +937,15 @@ public abstract boolean includeFilterSuppressNulls(Object filter)
*
* @param property Property for which the given primary serializer is used; never null.
*/
public JsonSerializer<?> handlePrimaryContextualization(JsonSerializer<?> ser,
@SuppressWarnings("unchecked")
public JsonSerializer<Object> handlePrimaryContextualization(JsonSerializer<?> ser,
BeanProperty property)
throws JsonMappingException
{
if (ser != null) {
ser = ser.createContextual(this, property);
}
return ser;
return (JsonSerializer<Object>) ser;
}

/**
Expand All @@ -975,14 +962,15 @@ public JsonSerializer<?> handlePrimaryContextualization(JsonSerializer<?> ser,
* @param property Property for which serializer is used, if any; null
* when deserializing root values
*/
public JsonSerializer<?> handleSecondaryContextualization(JsonSerializer<?> ser,
@SuppressWarnings("unchecked")
public JsonSerializer<Object> handleSecondaryContextualization(JsonSerializer<?> ser,
BeanProperty property)
throws JsonMappingException
{
if (ser != null) {
ser = ser.createContextual(this, property);
}
return ser;
return (JsonSerializer<Object>) ser;
}

/*
Expand Down

0 comments on commit bdbd67e

Please sign in to comment.