You are viewing a plain text version of this content. The canonical link for it is here.
Posted to scm@geronimo.apache.org by st...@apache.org on 2017/02/14 12:54:49 UTC

svn commit: r1782959 - in /geronimo/specs/trunk/geronimo-json_1.1_spec/src/main/java/javax/json: JsonPatchBuilder.java JsonPointer.java stream/JsonCollectors.java

Author: struberg
Date: Tue Feb 14 12:54:48 2017
New Revision: 1782959

URL: http://svn.apache.org/viewvc?rev=1782959&view=rev
Log:
GERONIMO-6558 apply changes based on the spec tickets Reinhard and I created

Modified:
    geronimo/specs/trunk/geronimo-json_1.1_spec/src/main/java/javax/json/JsonPatchBuilder.java
    geronimo/specs/trunk/geronimo-json_1.1_spec/src/main/java/javax/json/JsonPointer.java
    geronimo/specs/trunk/geronimo-json_1.1_spec/src/main/java/javax/json/stream/JsonCollectors.java

Modified: geronimo/specs/trunk/geronimo-json_1.1_spec/src/main/java/javax/json/JsonPatchBuilder.java
URL: http://svn.apache.org/viewvc/geronimo/specs/trunk/geronimo-json_1.1_spec/src/main/java/javax/json/JsonPatchBuilder.java?rev=1782959&r1=1782958&r2=1782959&view=diff
==============================================================================
--- geronimo/specs/trunk/geronimo-json_1.1_spec/src/main/java/javax/json/JsonPatchBuilder.java (original)
+++ geronimo/specs/trunk/geronimo-json_1.1_spec/src/main/java/javax/json/JsonPatchBuilder.java Tue Feb 14 12:54:48 2017
@@ -64,30 +64,6 @@ package javax.json;
  */
 public interface JsonPatchBuilder {
 
-    //X TODO 'apply'-methods can be simplified to <T extends JsonStructure> T apply(T target)
-    /**
-     * Applies the builded {@link JsonPatch} to the given target.<br>
-     * simplified call for {@code build().apply()}.
-     *
-     * @param target {@link JsonStructure} to apply the patch operations
-     *
-     * @return the created {@link JsonStructure} with all patch operations applied
-     *
-     * @throws NullPointerException if the given {@code target} is {@code null}
-     */
-    JsonStructure apply(JsonStructure target);
-
-    /**
-     * @see #apply(JsonStructure)
-     */
-    JsonObject apply(JsonObject target);
-
-    /**
-     * @see #apply(JsonStructure)
-     */
-    JsonArray apply(JsonArray target);
-
-
     /**
      * Adds an 'add'-operation to the {@link JsonPatch}
      *

Modified: geronimo/specs/trunk/geronimo-json_1.1_spec/src/main/java/javax/json/JsonPointer.java
URL: http://svn.apache.org/viewvc/geronimo/specs/trunk/geronimo-json_1.1_spec/src/main/java/javax/json/JsonPointer.java?rev=1782959&r1=1782958&r2=1782959&view=diff
==============================================================================
--- geronimo/specs/trunk/geronimo-json_1.1_spec/src/main/java/javax/json/JsonPointer.java (original)
+++ geronimo/specs/trunk/geronimo-json_1.1_spec/src/main/java/javax/json/JsonPointer.java Tue Feb 14 12:54:48 2017
@@ -21,17 +21,17 @@ package javax.json;
 /**
  * <p>This class is an immutable representation of a JSON Pointer as specified in
  * <a href="http://tools.ietf.org/html/rfc6901">RFC 6901</a>.
- * </p>
+ *
  *
  * <p>JSON Pointer is a string syntax for identifying a specific value
  * within a JavaScript Object Notation (JSON) document [RFC4627].
  * JSON Pointer is intended to be easily expressed in JSON string values
  * as well as Uniform Resource Identifier (URI) [RFC3986] fragment identifiers.
- * </p>
+ *
  * <p> The method {@link #getValue getValue()} returns the referenced value.
  * The methods {@link #add add()}, {@link #replace replace()},
  * and {@link #remove remove()} executes the operations specified in
- * <a href="http://tools.ietf.org/html/rfc6902">RFC 6902</a>. </p>
+ * <a href="http://tools.ietf.org/html/rfc6902">RFC 6902</a>.
  *
  * @since 1.1
  */
@@ -39,21 +39,23 @@ public interface JsonPointer {
 
     JsonValue getValue(JsonStructure target);
 
-    JsonStructure add(JsonStructure target, JsonValue value);
-
-    JsonStructure replace(JsonStructure target, JsonValue value);
 
-    JsonStructure remove(JsonStructure target);
+    /**
+     * Add or replace the value at the position referenced by this JsonPointer with
+     * the new value
+     * @param target structure in which the newValue should be added or replaced
+     * @param newValue the new value to set
+     * @param <T>
+     * @return the new structure after modifying the original JsonStrucure
+     */
+    <T extends JsonStructure> T add(T target, JsonValue newValue);
 
-    JsonObject add(JsonObject target, JsonValue value);
 
-    JsonArray add(JsonArray target, JsonValue value);
+    <T extends JsonStructure> T  remove(T target);
 
-    JsonObject replace(JsonObject target, JsonValue value);
+    boolean containsValue(JsonStructure target);
 
-    JsonArray replace(JsonArray target, JsonValue value);
+    <T extends JsonStructure> T  replace(T target, JsonValue value);
 
-    JsonObject remove(JsonObject target);
 
-    JsonArray remove(JsonArray target);
 }

Modified: geronimo/specs/trunk/geronimo-json_1.1_spec/src/main/java/javax/json/stream/JsonCollectors.java
URL: http://svn.apache.org/viewvc/geronimo/specs/trunk/geronimo-json_1.1_spec/src/main/java/javax/json/stream/JsonCollectors.java?rev=1782959&r1=1782958&r2=1782959&view=diff
==============================================================================
--- geronimo/specs/trunk/geronimo-json_1.1_spec/src/main/java/javax/json/stream/JsonCollectors.java (original)
+++ geronimo/specs/trunk/geronimo-json_1.1_spec/src/main/java/javax/json/stream/JsonCollectors.java Tue Feb 14 12:54:48 2017
@@ -32,9 +32,22 @@ public final class JsonCollectors {
     private JsonCollectors() {
     }
 
+    public static Collector<JsonValue, JsonArrayBuilder, JsonArray>
+                toJsonArray() {
+        //X TODO implement!
+        return null;
+    }
+
+    public static Collector<Map.Entry<String, JsonValue>, JsonObjectBuilder, JsonObject>
+                toJsonObject() {
+        //X TODO implement!
+        return null;
+    }
+
     public static Collector<JsonValue, JsonObjectBuilder, JsonObject>
                 toJsonObject(Function<JsonValue, String> keyMapper,
                              Function<JsonValue, JsonValue> valueMapper) {
+        //X TODO implement!
         return null;
     }
 
@@ -42,11 +55,13 @@ public final class JsonCollectors {
                 groupingBy(Function<JsonValue, String> classifier,
                            Collector<JsonValue, JsonArrayBuilder, JsonArray> downstream) {
 
+        //X TODO implement!
         return null;
     }
 
     public static Collector<JsonValue, Map<String, JsonArrayBuilder>, JsonObject>
                 groupingBy(Function<JsonValue, String> classifier) {
+        //X TODO implement!
         return null;
     }
 }