|
|
|
@ -13,6 +13,7 @@ import java.io.IOException;
|
|
|
|
|
import java.io.InputStream; |
|
|
|
|
import java.io.InputStreamReader; |
|
|
|
|
import java.math.BigDecimal; |
|
|
|
|
import java.math.BigInteger; |
|
|
|
|
import java.util.ArrayList; |
|
|
|
|
import java.util.Collection; |
|
|
|
|
import java.util.Iterator; |
|
|
|
@ -29,14 +30,14 @@ public class JacksonJsonNodeJsonProvider extends AbstractJsonProvider {
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
/** |
|
|
|
|
* Initialize the JacksonTreeJsonProvider with the default ObjectMapper and ObjectReader |
|
|
|
|
* Initialize the JacksonJsonNodeJsonProvider with the default ObjectMapper and ObjectReader |
|
|
|
|
*/ |
|
|
|
|
public JacksonJsonNodeJsonProvider() { |
|
|
|
|
this(defaultObjectMapper); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
/** |
|
|
|
|
* Initialize the JacksonTreeJsonProvider with a custom ObjectMapper and ObjectReader. |
|
|
|
|
* Initialize the JacksonJsonNodeJsonProvider with a custom ObjectMapper and ObjectReader. |
|
|
|
|
* |
|
|
|
|
* @param objectMapper the ObjectMapper to use |
|
|
|
|
*/ |
|
|
|
@ -174,9 +175,9 @@ public class JacksonJsonNodeJsonProvider extends AbstractJsonProvider {
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
public void removeProperty(Object obj, Object key) { |
|
|
|
|
if (isMap(obj)) |
|
|
|
|
if (isMap(obj)) { |
|
|
|
|
toJsonObject(obj).remove(key.toString()); |
|
|
|
|
else { |
|
|
|
|
} else { |
|
|
|
|
ArrayNode array = toJsonArray(obj); |
|
|
|
|
int index = key instanceof Integer ? (Integer) key : Integer.parseInt(key.toString()); |
|
|
|
|
array.remove(index); |
|
|
|
@ -258,7 +259,9 @@ public class JacksonJsonNodeJsonProvider extends AbstractJsonProvider {
|
|
|
|
|
objectNode.put(key.toString(), (Long) value); |
|
|
|
|
} else if (value instanceof Short) { |
|
|
|
|
objectNode.put(key.toString(), (Short) value); |
|
|
|
|
} else if (value instanceof Double) { |
|
|
|
|
} else if (value instanceof BigInteger) { |
|
|
|
|
objectNode.put(key.toString(), (BigInteger) value); |
|
|
|
|
} else if (value instanceof Double) { |
|
|
|
|
objectNode.put(key.toString(), (Double) value); |
|
|
|
|
} else if (value instanceof Float) { |
|
|
|
|
objectNode.put(key.toString(), (Float) value); |
|
|
|
|