You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@sling.apache.org by pa...@apache.org on 2018/08/30 14:19:43 UTC

[sling-org-apache-sling-commons-johnzon] branch master updated: SLING-7869: Update javax.json.spi.JsonProvider to 1.1

This is an automated email from the ASF dual-hosted git repository.

pauls pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/sling-org-apache-sling-commons-johnzon.git


The following commit(s) were added to refs/heads/master by this push:
     new d5ea83c  SLING-7869: Update javax.json.spi.JsonProvider to 1.1
d5ea83c is described below

commit d5ea83c669c060eaee393c73036d499de4d78771
Author: Karl Pauls <ka...@gmail.com>
AuthorDate: Thu Aug 30 16:19:37 2018 +0200

    SLING-7869: Update javax.json.spi.JsonProvider to 1.1
---
 src/main/java/javax/json/spi/JsonProvider.java | 216 +++++++++++++++++++++++++
 1 file changed, 216 insertions(+)

diff --git a/src/main/java/javax/json/spi/JsonProvider.java b/src/main/java/javax/json/spi/JsonProvider.java
index 5464ce6..430a788 100644
--- a/src/main/java/javax/json/spi/JsonProvider.java
+++ b/src/main/java/javax/json/spi/JsonProvider.java
@@ -22,13 +22,26 @@ import java.io.InputStream;
 import java.io.OutputStream;
 import java.io.Reader;
 import java.io.Writer;
+import java.math.BigDecimal;
+import java.math.BigInteger;
+import java.util.Collection;
 import java.util.Map;
 
+import javax.json.JsonArray;
 import javax.json.JsonArrayBuilder;
 import javax.json.JsonBuilderFactory;
+import javax.json.JsonMergePatch;
+import javax.json.JsonNumber;
+import javax.json.JsonObject;
 import javax.json.JsonObjectBuilder;
+import javax.json.JsonPatch;
+import javax.json.JsonPatchBuilder;
+import javax.json.JsonPointer;
 import javax.json.JsonReader;
 import javax.json.JsonReaderFactory;
+import javax.json.JsonString;
+import javax.json.JsonStructure;
+import javax.json.JsonValue;
 import javax.json.JsonWriter;
 import javax.json.JsonWriterFactory;
 import javax.json.stream.JsonGenerator;
@@ -36,6 +49,9 @@ import javax.json.stream.JsonGeneratorFactory;
 import javax.json.stream.JsonParser;
 import javax.json.stream.JsonParserFactory;
 
+import org.osgi.annotation.versioning.ProviderType;
+
+@ProviderType
 public abstract class JsonProvider {
     private static final class Holder {
         private static final JsonProvider DEFAULT = new org.apache.johnzon.core.JsonProviderImpl();
@@ -73,10 +89,210 @@ public abstract class JsonProvider {
 
     public abstract JsonReaderFactory createReaderFactory(Map<String, ?> config);
 
+    /**
+     * Create an empty JsonObjectBuilder
+     * @since 1.0
+     */
     public abstract JsonObjectBuilder createObjectBuilder();
 
+    /**
+     * Creates a JSON object builder, initialized with the specified JsonObject.
+     * @since 1.1
+     */
+    public JsonObjectBuilder createObjectBuilder(JsonObject jsonObject) {
+        throw new UnsupportedOperationException();
+    }
+
+    /**
+     * Creates a JSON object builder, initialized with the specified Map.
+     * @since 1.1
+     */
+    public JsonObjectBuilder createObjectBuilder(Map<String, Object> map) {
+        throw new UnsupportedOperationException();
+    }
+
     public abstract JsonArrayBuilder createArrayBuilder();
 
+    public JsonArrayBuilder createArrayBuilder(JsonArray initialData) {
+        throw new UnsupportedOperationException();
+    }
+
+    public JsonArrayBuilder createArrayBuilder(Collection<?> initialData) {
+        throw new UnsupportedOperationException();
+    }
+
+    /**
+     * Create a {@link JsonPointer} based on the given path string
+     *
+     * @since 1.1
+     */
+    public JsonPointer createPointer(String path) {
+        throw new UnsupportedOperationException();
+    }
+
     public abstract JsonBuilderFactory createBuilderFactory(Map<String, ?> config);
+
+
+    public JsonString createValue(String value) {
+        throw new UnsupportedOperationException();
+    }
+
+    public JsonNumber createValue(int value) {
+        throw new UnsupportedOperationException();
+    }
+
+    public JsonNumber createValue(long value) {
+        throw new UnsupportedOperationException();
+    }
+
+    public JsonNumber createValue(double value) {
+        throw new UnsupportedOperationException();
+    }
+
+    public JsonNumber createValue(BigDecimal value) {
+        throw new UnsupportedOperationException();
+    }
+
+    public JsonNumber createValue(BigInteger value) {
+        throw new UnsupportedOperationException();
+    }
+
+    /**
+     * Create a {@link JsonPatch} as defined in
+     * <a href="https://tools.ietf.org/html/rfc6902">RFC-6902</a>.
+     *
+     * @param array with the patch operations
+     * @return the JsonPatch based on the given operations
+     *
+     * @see #createDiff(JsonStructure, JsonStructure)
+     *
+     * @since 1.1
+     */
+    public JsonPatch createPatch(JsonArray array) {
+        throw new UnsupportedOperationException();
+    }
+
+    /**
+     * Create a {@link JsonPatch} by comparing the source to the target as defined in
+     * <a href="https://tools.ietf.org/html/rfc6902">RFC-6902</a>.
+     *
+     * Applying this {@link JsonPatch} to the source you will give you the target.
+     *
+     * @see #createPatch(JsonArray)
+     *
+     * @since 1.1
+     */
+    public JsonPatch createDiff(JsonStructure source, JsonStructure target) {
+        throw new UnsupportedOperationException();
+    }
+
+    /**
+     * Create a new JsonPatchBuilder
+     * @since 1.1
+     */
+    public JsonPatchBuilder createPatchBuilder() {
+        throw new UnsupportedOperationException();
+    }
+
+    /**
+     * Create a new JsonPatchBuilder from initial data.
+     * @param initialData the initial patch operations
+     * @since 1.1
+     */
+    public JsonPatchBuilder createPatchBuilder(JsonArray initialData) {
+        throw new UnsupportedOperationException();
+    }
+
+    /**
+     * Create a merge patch based on the given JsonValue.
+     *
+     * If you have the following JsonMergePatch:
+     *
+     * <pre>
+     * {
+     *   "a":"z",
+     *   "c": {
+     *     "f": null
+     *   }
+     * }
+     * </pre>
+     *
+     * and apply it to the following JSON
+     *
+     * <pre>
+     * {
+     *   "a": "b",
+     *   "c": {
+     *     "d": "e",
+     *     "f": "g"
+     *   }
+     * }
+     * </pre>
+     *
+     * you will get the following result:
+     *
+     * <pre>
+     * {
+     *   "a": "z",
+     *   "c": {
+     *     "d": "e",
+     *   }
+     * }
+     * </pre>
+     *
+     * @see #createMergeDiff(JsonValue, JsonValue)
+     *
+     * @since 1.1
+     */
+    public JsonMergePatch createMergePatch(JsonValue patch) {
+        throw new UnsupportedOperationException();
+    }
+
+
+    /**
+     * Create a merge patch by comparing the source to the target.
+     * Applying this JsonMergePatch to the source will give you the target.
+     * A MergePatch is a JsonValue as defined in http://tools.ietf.org/html/rfc7396
+     *
+     * If you have a JSON like
+     * <pre>
+     * {
+     *   "a": "b",
+     *   "c": {
+     *     "d": "e",
+     *     "f": "g"
+     *   }
+     * }
+     * </pre>
+     *
+     * and comparing it with
+     *
+     * <pre>
+     * {
+     *   "a": "z",
+     *   "c": {
+     *     "d": "e",
+     *   }
+     * }
+     * </pre>
+     *
+     * you will get the following JsonMergePatch:
+     *
+     * <pre>
+     * {
+     *   "a":"z",
+     *   "c": {
+     *     "f": null
+     *   }
+     * }
+     * </pre>
+     *
+     * @see #createMergePatch(JsonValue)
+     *
+     * @since 1.1
+     */
+    public JsonMergePatch createMergeDiff(JsonValue source, JsonValue target) {
+        throw new UnsupportedOperationException();
+    }
 }