Skip to main content

[jsr353-experts] JSON_PROCESSING_SPEC-45: JsonObject/JsonArray accessor methods that take default values

  • From: Jitendra Kotamraju < >
  • To:
  • Subject: [jsr353-experts] JSON_PROCESSING_SPEC-45: JsonObject/JsonArray accessor methods that take default values
  • Date: Tue, 22 Jan 2013 19:05:06 -0800

The issue asks for additional accessor methods that take default values. Here is the initial proposal.

Add the following methods:

// If there is mapping and the mapping is JsonString, then JsonString#getValue()
// else default value
String getStringValue(String name, String defaultValue)

// If there is mapping and the mapping is JsonNumber, then JsonNumber#getIntValue()
// else default value
int getIntValue(String name, int defaultValue)

// If there is mapping and the mapping is JsonValue.TRUE/JsonValue.FALSE, then mapped value
// else default value
boolean getBooleanValue(String name, boolean defaultValue)

// If there is no mapping, throw NPE
// If it doesn't map to JsonValue.TRUE/Json.VALUE, throw CCE
// return true for JsonValue.TRUE, false for JsonValue.FALSE
boolean getBooleanValue(String name)


Also, fix JSON_PROCESSING_SPEC-43 : JsonObject#getIntValue() javadoc says it would return null

Jitu


[jsr353-experts] JSON_PROCESSING_SPEC-45: JsonObject/JsonArray accessor methods that take default values

Jitendra Kotamraju 01/23/2013

[jsr353-experts] Re: [json-processing-spec users] JSON_PROCESSING_SPEC-45: JsonObject/JsonArray accessor methods that take default values

Jonathan Fuerth 01/23/2013

[jsr353-experts] Re: [json-processing-spec users] Re: JSON_PROCESSING_SPEC-45: JsonObject/JsonArray accessor methods that take default values

Jitendra Kotamraju 01/24/2013

[jsr353-experts] Re: [json-processing-spec users] Re: Re: JSON_PROCESSING_SPEC-45: JsonObject/JsonArray accessor methods that take default values

Jitendra Kotamraju 01/29/2013
 
 
Close
loading
Please Confirm
Close