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/22 20:02:25 UTC
svn commit: r1784058 -
/geronimo/specs/trunk/geronimo-json_1.1_spec/src/main/java/javax/json/JsonObjectBuilder.java
Author: struberg
Date: Wed Feb 22 20:02:25 2017
New Revision: 1784058
URL: http://svn.apache.org/viewvc?rev=1784058&view=rev
Log:
#6558 improve JsonObjectBuilder docs
Modified:
geronimo/specs/trunk/geronimo-json_1.1_spec/src/main/java/javax/json/JsonObjectBuilder.java
Modified: geronimo/specs/trunk/geronimo-json_1.1_spec/src/main/java/javax/json/JsonObjectBuilder.java
URL: http://svn.apache.org/viewvc/geronimo/specs/trunk/geronimo-json_1.1_spec/src/main/java/javax/json/JsonObjectBuilder.java?rev=1784058&r1=1784057&r2=1784058&view=diff
==============================================================================
--- geronimo/specs/trunk/geronimo-json_1.1_spec/src/main/java/javax/json/JsonObjectBuilder.java (original)
+++ geronimo/specs/trunk/geronimo-json_1.1_spec/src/main/java/javax/json/JsonObjectBuilder.java Wed Feb 22 20:02:25 2017
@@ -22,33 +22,119 @@ import java.math.BigInteger;
/**
* A JsonObjectBuilder can be used to build {@link JsonObject JsonObjects}.
* Instances are not thread safe.
+ *
+ * Calling any of those methods with either the {@code name} or {@code value} param as {@code null}
+ * will result in a {@cod NullPointerException}
*/
public interface JsonObjectBuilder {
+ /**
+ * Add the given JsonValue value to the JsonObject to be created.
+ * If a value with that name already exists it will be replaced by the new value.
+ * @param name the JSON attribute name
+ * @param value the JsonValue to add
+ * @return the current JsonObjectBuilder
+ */
JsonObjectBuilder add(String name, JsonValue value);
+ /**
+ * Add the given String value to the JsonObject to be created.
+ * If a value with that name already exists it will be replaced by the new value.
+ * @param name the JSON attribute name
+ * @param value the String value to add
+ * @return the current JsonObjectBuilder
+ */
JsonObjectBuilder add(String name, String value);
+ /**
+ * Add the given BigInteger value to the JsonObject to be created.
+ * If a value with that name already exists it will be replaced by the new value.
+ * @param name the JSON attribute name
+ * @param value the BigInteger value to add
+ * @return the current JsonObjectBuilder
+ */
JsonObjectBuilder add(String name, BigInteger value);
+ /**
+ * Add the given BigDecimal value to the JsonObject to be created.
+ * If a value with that name already exists it will be replaced by the new value.
+ * @param name the JSON attribute name
+ * @param value the BigDecimal value to add
+ * @return the current JsonObjectBuilder
+ */
JsonObjectBuilder add(String name, BigDecimal value);
+ /**
+ * Add the given int value to the JsonObject to be created.
+ * If a value with that name already exists it will be replaced by the new value.
+ * @param name the JSON attribute name
+ * @param value to add
+ * @return the current JsonObjectBuilder
+ */
JsonObjectBuilder add(String name, int value);
+ /**
+ * Add the given long value to the JsonObject to be created.
+ * If a value with that name already exists it will be replaced by the new value.
+ * @param name the JSON attribute name
+ * @param value to add
+ * @return the current JsonObjectBuilder
+ */
JsonObjectBuilder add(String name, long value);
+ /**
+ * Add the given double value to the JsonObject to be created.
+ * If a value with that name already exists it will be replaced by the new value.
+ * @param name the JSON attribute name
+ * @param value to add
+ * @return the current JsonObjectBuilder
+ */
JsonObjectBuilder add(String name, double value);
+ /**
+ * Add the given boolean value to the JsonObject to be created.
+ * If a value with that name already exists it will be replaced by the new value.
+ * @param name the JSON attribute name
+ * @param value to add
+ * @return the current JsonObjectBuilder
+ */
JsonObjectBuilder add(String name, boolean value);
+ /**
+ * Add a {@link JsonValue#NULL} value to the JsonObject to be created.
+ * If a value with that name already exists it will be replaced by the null value.
+ * @param name the JSON attribute name
+ * @return the current JsonObjectBuilder
+ */
JsonObjectBuilder addNull(String name);
+ /**
+ * Use the given {@link JsonObjectBuilder} to create a {@link JsonObject} which will be
+ * added to the JsonObject to be created by this builder.
+ * If a value with that name already exists it will be replaced by the new value.
+ * @param name the JSON attribute name
+ * @param builder for creating the JsonObject to add
+ * @return the current JsonObjectBuilder
+ */
JsonObjectBuilder add(String name, JsonObjectBuilder builder);
+ /**
+ * Use the given {@link JsonArrayBuilder} to create a {@link JsonArray} which will be
+ * added to the JsonObject to be created by this builder.
+ * If a value with that name already exists it will be replaced by the new value.
+ * @param name the JSON attribute name
+ * @param builder for creating the JsonArray to add
+ * @return the current JsonObjectBuilder
+ */
JsonObjectBuilder add(String name, JsonArrayBuilder builder);
+ /**
+ * @return a {@link JsonObject} based on the added values.
+ */
JsonObject build();
/**
+ * Add all of the attributes of the given {@link JsonObjectBuilder} to the current one
+ *
* @since 1.1
*/
default JsonObjectBuilder addAll(JsonObjectBuilder builder) {
@@ -56,6 +142,8 @@ public interface JsonObjectBuilder {
}
/**
+ * Remove the attribute with the given name from the builder.
+ *
* @since 1.1
*/
default JsonObjectBuilder remove(String name) {