Skip to main content

[json-processing-spec issues] [JIRA] Commented: (JSON_PROCESSING_SPEC-54) Shorten getter method names; make chained getters read well when used together

  • From: "jfuerth (JIRA)" < >
  • To:
  • Subject: [json-processing-spec issues] [JIRA] Commented: (JSON_PROCESSING_SPEC-54) Shorten getter method names; make chained getters read well when used together
  • Date: Sat, 9 Feb 2013 17:17:53 +0000 (GMT+00:00)
  • Auto-submitted: auto-generated


    [ 
http://java.net/jira/browse/JSON_PROCESSING_SPEC-54?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=355766#action_355766
 ] 

jfuerth commented on JSON_PROCESSING_SPEC-54:
---------------------------------------------

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
2. When the JsonObject or JsonArray getter method names match the JsonNumber 
getter method name, chained calls like 
{{jsonObject.getNumber("key").getDouble()}} don't read as well as 
{{jsonObject.getNumber("key").doubleValue()}}.

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.

> Shorten getter method names; make chained getters read well when used 
> together
> ------------------------------------------------------------------------------
>
>                 Key: JSON_PROCESSING_SPEC-54
>                 URL: http://java.net/jira/browse/JSON_PROCESSING_SPEC-54
>             Project: json-processing-spec
>          Issue Type: Improvement
>            Reporter: jfuerth
>             Fix For: 1.0-pfd
>
>
> The idea here is to make the following two changes, which work well 
> together:
> 1. Remove 'value' from most getter names
> 2. Use the same method naming convention on JsonNumber as is used on 
> java.lang.Number
> 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 JSON_PROCESSING_SPEC-53, has been implemented 
> here:
> https://github.com/jfuerth/javax-json/commit/shorter-method-names

-- 
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators: 
http://java.net/jira/secure/Administrators.jspa
-
For more information on JIRA, see: http://www.atlassian.com/software/jira

        


[json-processing-spec issues] [JIRA] Created: (JSON_PROCESSING_SPEC-54) Shorten getter method names; make chained getters read well when used together

jfuerth (JIRA) 02/06/2013

[json-processing-spec issues] [JIRA] Updated: (JSON_PROCESSING_SPEC-54) Shorten getter method names; make chained getters read well when used together

jitu (JIRA) 02/06/2013

[json-processing-spec issues] [JIRA] Updated: (JSON_PROCESSING_SPEC-54) Shorten getter method names; make chained getters read well when used together

jitu (JIRA) 02/09/2013

[json-processing-spec issues] [JIRA] Commented: (JSON_PROCESSING_SPEC-54) Shorten getter method names; make chained getters read well when used together

jfuerth (JIRA) 02/09/2013

[json-processing-spec issues] [JIRA] Resolved: (JSON_PROCESSING_SPEC-54) Shorten getter method names; make chained getters read well when used together

jitu (JIRA) 02/10/2013
 
 
Close
loading
Please Confirm
Close