Skip to content

Commit

Permalink
minor trimming, renaming
Browse files Browse the repository at this point in the history
  • Loading branch information
cowtowncoder committed Mar 16, 2018
1 parent cbca4d8 commit db69efd
Show file tree
Hide file tree
Showing 18 changed files with 90 additions and 117 deletions.
155 changes: 64 additions & 91 deletions src/main/java/com/fasterxml/jackson/databind/SerializerProvider.java

Large diffs are not rendered by default.

Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ public JsonNodeType getNodeType() {
public final void serialize(JsonGenerator g, SerializerProvider provider)
throws IOException
{
provider.defaultSerializeNull(g);
provider.defaultSerializeNullValue(g);
}

@Override
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -108,7 +108,7 @@ public double asDouble(double defaultValue)
public final void serialize(JsonGenerator gen, SerializerProvider serializers) throws IOException
{
if (_value == null) {
serializers.defaultSerializeNull(gen);
serializers.defaultSerializeNullValue(gen);
} else if (_value instanceof JsonSerializable) {
((JsonSerializable) _value).serialize(gen, serializers);
} else {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -104,7 +104,7 @@ public void serializeContents(Object value0, JsonGenerator g, SerializerProvider
for (; i < len; ++i) {
Object elem = value.get(i);
if (elem == null) {
provider.defaultSerializeNull(g);
provider.defaultSerializeNullValue(g);
} else {
Class<?> cc = elem.getClass();
JsonSerializer<Object> serializer = serializers.serializerFor(cc);
Expand Down Expand Up @@ -139,7 +139,7 @@ public void serializeContentsUsing(List<?> value, JsonGenerator jgen, Serializer
Object elem = value.get(i);
try {
if (elem == null) {
provider.defaultSerializeNull(jgen);
provider.defaultSerializeNullValue(jgen);
} else if (typeSer == null) {
ser.serialize(elem, jgen, provider);
} else {
Expand All @@ -166,7 +166,7 @@ public void serializeTypedContents(List<?> value, JsonGenerator jgen, Serializer
for (; i < len; ++i) {
Object elem = value.get(i);
if (elem == null) {
provider.defaultSerializeNull(jgen);
provider.defaultSerializeNullValue(jgen);
} else {
Class<?> cc = elem.getClass();
JsonSerializer<Object> serializer = serializers.serializerFor(cc);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -98,7 +98,7 @@ private final void serializeContents(List<String> value, JsonGenerator g,
for (; i < len; ++i) {
String str = value.get(i);
if (str == null) {
provider.defaultSerializeNull(g);
provider.defaultSerializeNullValue(g);
} else {
g.writeString(str);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,7 @@ public void serializeContents(Iterator<?> value, JsonGenerator g,
do {
Object elem = value.next();
if (elem == null) {
provider.defaultSerializeNull(g);
provider.defaultSerializeNullValue(g);
} else if (typeSer == null) {
serializer.serialize(elem, g, provider);
} else {
Expand All @@ -102,7 +102,7 @@ protected void _serializeDynamicContents(Iterator<?> value, JsonGenerator g,
do {
Object elem = value.next();
if (elem == null) {
provider.defaultSerializeNull(g);
provider.defaultSerializeNullValue(g);
continue;
}
Class<?> cc = elem.getClass();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -196,7 +196,7 @@ private void serializeContentsSlow(String[] value, JsonGenerator gen, Serializer
for (int i = 0, len = value.length; i < len; ++i) {
String str = value[i];
if (str == null) {
provider.defaultSerializeNull(gen);
provider.defaultSerializeNullValue(gen);
} else {
ser.serialize(value[i], gen, provider);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -103,7 +103,7 @@ private final void serializeContents(Collection<String> value, JsonGenerator g,
try {
for (String str : value) {
if (str == null) {
provider.defaultSerializeNull(g);
provider.defaultSerializeNullValue(g);
} else {
g.writeString(str);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -114,7 +114,7 @@ public void serializeContents(Collection<?> value, JsonGenerator g, SerializerPr
do {
Object elem = it.next();
if (elem == null) {
provider.defaultSerializeNull(g);
provider.defaultSerializeNullValue(g);
} else {
Class<?> cc = elem.getClass();
JsonSerializer<Object> serializer = serializers.serializerFor(cc);
Expand Down Expand Up @@ -151,7 +151,7 @@ public void serializeContentsUsing(Collection<?> value, JsonGenerator g, Seriali
Object elem = it.next();
try {
if (elem == null) {
provider.defaultSerializeNull(g);
provider.defaultSerializeNullValue(g);
} else {
if (typeSer == null) {
ser.serialize(elem, g, provider);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -88,7 +88,7 @@ public void serializeContents(Iterable<?> value, JsonGenerator jgen,
do {
Object elem = it.next();
if (elem == null) {
provider.defaultSerializeNull(jgen);
provider.defaultSerializeNullValue(jgen);
continue;
}
JsonSerializer<Object> currSerializer = _elementSerializer;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -157,7 +157,7 @@ public void serialize(Object bean, JsonGenerator gen, SerializerProvider prov) t
try {
Object value = _accessor.getValue(bean);
if (value == null) {
prov.defaultSerializeNull(gen);
prov.defaultSerializeNullValue(gen);
return;
}
JsonSerializer<Object> ser = _valueSerializer;
Expand Down Expand Up @@ -186,7 +186,7 @@ public void serializeWithType(Object bean, JsonGenerator gen, SerializerProvider
value = _accessor.getValue(bean);
// and if we got null, can also just write it directly
if (value == null) {
provider.defaultSerializeNull(gen);
provider.defaultSerializeNullValue(gen);
return;
}
JsonSerializer<Object> ser = _valueSerializer;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -655,7 +655,7 @@ public void serializeFields(Map<?,?> value, JsonGenerator gen, SerializerProvide
}
// And then value
if (valueElem == null) {
provider.defaultSerializeNull(gen);
provider.defaultSerializeNullValue(gen);
continue;
}
JsonSerializer<Object> serializer = _valueSerializer;
Expand Down Expand Up @@ -753,7 +753,7 @@ public void serializeFieldsUsing(Map<?,?> value, JsonGenerator gen, SerializerPr
}
final Object valueElem = entry.getValue();
if (valueElem == null) {
provider.defaultSerializeNull(gen);
provider.defaultSerializeNullValue(gen);
} else {
try {
if (typeSer == null) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -231,7 +231,7 @@ public void serializeContents(Object[] value, JsonGenerator gen, SerializerProvi
for (; i < len; ++i) {
elem = value[i];
if (elem == null) {
provider.defaultSerializeNull(gen);
provider.defaultSerializeNullValue(gen);
continue;
}
Class<?> cc = elem.getClass();
Expand Down Expand Up @@ -263,7 +263,7 @@ public void serializeContentsUsing(Object[] value, JsonGenerator jgen, Serialize
for (; i < len; ++i) {
elem = value[i];
if (elem == null) {
provider.defaultSerializeNull(jgen);
provider.defaultSerializeNullValue(jgen);
continue;
}
if (typeSer == null) {
Expand All @@ -288,7 +288,7 @@ public void serializeTypedContents(Object[] value, JsonGenerator jgen, Serialize
for (; i < len; ++i) {
elem = value[i];
if (elem == null) {
provider.defaultSerializeNull(jgen);
provider.defaultSerializeNullValue(jgen);
continue;
}
Class<?> cc = elem.getClass();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -360,7 +360,7 @@ public void serialize(T ref, JsonGenerator g, SerializerProvider provider)
Object value = _getReferencedIfPresent(ref);
if (value == null) {
if (_unwrapper == null) {
provider.defaultSerializeNull(g);
provider.defaultSerializeNullValue(g);
}
return;
}
Expand All @@ -383,7 +383,7 @@ public void serializeWithType(T ref,
Object value = _getReferencedIfPresent(ref);
if (value == null) {
if (_unwrapper == null) {
provider.defaultSerializeNull(g);
provider.defaultSerializeNullValue(g);
}
return;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -147,7 +147,7 @@ public void serialize(Object value, JsonGenerator gen, SerializerProvider provid
Object delegateValue = convertValue(value);
// should we accept nulls?
if (delegateValue == null) {
provider.defaultSerializeNull(gen);
provider.defaultSerializeNullValue(gen);
return;
}
// 02-Apr-2015, tatu: As per [databind#731] may need to do dynamic lookup
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,7 @@ public void serialize(JsonGenerator gen, SerializerProvider provider)
gen.writeRaw('(');

if (_value == null) {
provider.defaultSerializeNull(gen);
provider.defaultSerializeNullValue(gen);
} else {
// NOTE: Escape line-separator characters that break JSONP only if no custom character escapes are set.
// If custom escapes are in place JSONP-breaking characters will not be escaped and it is recommended to
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,7 @@ public void serialize(JsonGenerator jgen, SerializerProvider provider)
// First, wrapping:
if (_prefix != null) jgen.writeRaw(_prefix);
if (_value == null) {
provider.defaultSerializeNull(jgen);
provider.defaultSerializeNullValue(jgen);
} else if (_serializationType != null) {
provider.findTypedValueSerializer(_serializationType, true, null).serialize(_value, jgen, provider);
} else {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ public void testFindExplicit() throws JsonMappingException

// Should have working default key and null key serializers
assertNotNull(prov.findKeySerializer(mapper.constructType(String.class), null));
assertNotNull(prov.getDefaultNullKeySerializer());
// assertNotNull(prov.getDefaultNullKeySerializer());
assertNotNull(prov.getDefaultNullValueSerializer());
// as well as 'unknown type' one (throws exception)
assertNotNull(prov.getUnknownTypeSerializer(getClass()));
Expand Down

0 comments on commit db69efd

Please sign in to comment.