Search in sources :

Example 1 with JsonSerializable

use of com.fasterxml.jackson.databind.JsonSerializable in project jackson-databind by FasterXML.

the class ArrayNode method serialize.

/*
    /**********************************************************
    /* Public API, serialization
    /**********************************************************
     */
@Override
public void serialize(JsonGenerator f, SerializerProvider provider) throws IOException {
    final List<JsonNode> c = _children;
    final int size = c.size();
    f.writeStartArray(size);
    for (int i = 0; i < size; ++i) {
        // we'll typically have array list
        // For now, assuming it's either BaseJsonNode, JsonSerializable
        JsonNode n = c.get(i);
        if (n instanceof BaseJsonNode) {
            ((BaseJsonNode) n).serialize(f, provider);
        } else {
            ((JsonSerializable) n).serialize(f, provider);
        }
    }
    f.writeEndArray();
}
Also used : JsonSerializable(com.fasterxml.jackson.databind.JsonSerializable) JsonNode(com.fasterxml.jackson.databind.JsonNode)

Aggregations

JsonNode (com.fasterxml.jackson.databind.JsonNode)1 JsonSerializable (com.fasterxml.jackson.databind.JsonSerializable)1