Skip to content

Commit

Permalink
introduce null-save JsonObjectBuilder.add and JsonGenerator.write met…
Browse files Browse the repository at this point in the history
…hods jakartaee#213

Signed-off-by: Jorge Bescos Gascon <[email protected]>
  • Loading branch information
jbescos committed Oct 4, 2021
1 parent d166d5d commit d9df212
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 2 deletions.
6 changes: 6 additions & 0 deletions api/src/main/java/jakarta/json/JsonBuilderFactory.java
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,12 @@
*/
public interface JsonBuilderFactory {

/**
* Configuration property to ignore null values. All providers
* must support this property. The value of the property is boolean.
*/
public static final String IGNORE_ADDING_IF_NULL = "jakarta.json.JsonBuilderFactory.ignoreAddingIfNull";

/**
* Creates a {@code JsonObjectBuilder} instance that is used to build
* {@link JsonObject}.
Expand Down
5 changes: 3 additions & 2 deletions api/src/main/java/jakarta/json/JsonObjectBuilder.java
Original file line number Diff line number Diff line change
Expand Up @@ -86,8 +86,9 @@
* </code>
* </pre>
*
* <p>This class does <em>not</em> allow <code>null</code> to be used as a name or
* value while building the JSON object
* <p>By default, this class does <em>not</em> allow <code>null</code> to be used as a name or
* value while building the JSON object. It is possible to change this behavior with configuration
* {@link JsonBuilderFactory#IGNORE_ADDING_IF_NULL}
*
* @see JsonArrayBuilder
*/
Expand Down

0 comments on commit d9df212

Please sign in to comment.