package com.github.nsnjson.encoding;

import com.fasterxml.jackson.databind.JsonNode;

import java.util.Optional;

public class Encoder {

    private static final Encoding DEFAULT_ENCODING = new DefaultEncoding();

    /**
     * Encodes JSON to NSNJSON presentation.
     * @param data any JSON data
     * @return NSNJSON presentation of JSON
     */
    public static Optional<JsonNode> encode(JsonNode data) {
        return DEFAULT_ENCODING.encode(data);
    }

    /**
     * Encodes JSON to NSNJSON presentation by custom encoding.
     * @param data any JSON data
     * @return NSNJSON presentation of JSON
     */
    public static Optional<JsonNode> encode(JsonNode data, Encoding encoding) {
        return Optional.ofNullable(encoding).orElse(DEFAULT_ENCODING).encode(data);
    }

}
@@ -78,16 +78,60 @@
 sonNode;
+%0Aimport com.github.nsnjson.encoding.style.*;
 %0A%0Aimport
@@ -253,16 +253,100 @@
 ing();%0A%0A
+    private static final Encoding ARRAY_STYLE_ENCODING = new ArrayStyleEncoding();%0A%0A
     /**%0A
@@ -917,9 +917,141 @@
 %0A    %7D%0A%0A
+    public static Optional%3CJsonNode%3E encodeWithArrayStyle(JsonNode data) %7B%0A        return ARRAY_STYLE_ENCODING.encode(data);%0A    %7D%0A%0A
 %7D

Implement method { Encoder @ encodeWithArrayStyle }