[JSON_PROCESSING_SPEC-54] Shorten getter method names; make chained getters read well when used together Created: 06/Feb/13 Updated: 10/Feb/13 Resolved: 10/Feb/13
|Remaining Estimate:||Not Specified|
|Time Spent:||Not Specified|
|Original Estimate:||Not Specified|
The idea here is to make the following two changes, which work well together:
1. Remove 'value' from most getter names
The result is that repetitive-looking use cases like jsonObject.getNumberValue("num").getDoubleValue() turn into this non-repetitive arrangement: jsonObject.getNumber("num").doubleValue().
This suggestion, along with
|Comment by jitu [ 08/Feb/13 ]|
Should we use one scheme here: getInt() even in JsonNumber ? Then, s/getIntValueExact()/getIntExact()
|Comment by jfuerth [ 09/Feb/13 ]|
Good point. I thought about that too when I was making the method name changes.
The conclusion I arrived at was that JsonParser#getInt() makes somewhat more sense than JsonParser#intValue(). It matches JsonArray#getInt(int) and JsonObject#getInt(String). Only JsonNumber differs, and for these two reasons:
1. JsonNumber serves a similar purpose to java.lang.Number, and to me this is a strong case for staying with the familiar/expected naming scheme
So my preference is still to stay with getXXX() method names across the whole javax.json API, but go with the very well established java.lang.Number method names on JsonNumber.
|Comment by jitu [ 10/Feb/13 ]|
Fixing it as suggested.