Skip to main content

[json-processing-spec users] Re: BigDecimal for equals()/hashCode()

  • From: Jitendra Kotamraju < >
  • To:
  • Subject: [json-processing-spec users] Re: BigDecimal for equals()/hashCode()
  • Date: Mon, 11 Feb 2013 14:06:50 -0800




2. Remove the NumberType enum. I believe it originally served more of a purpose ambitious, but in its current form with only two members, it's much more cumbersome to use than, say, a JsonNumber.isIntegral() method.
That may be true.

To me, it's pretty plain just by looking at the example code in the javadoc for JsonNumber.getNumberType():

 switch(getNumberType()) {
     case INTEGER :
         long l = getLongValue(); break;
     case DECIMAL :
         BigDecimal bd = getBigDecimalValue(); break;
 }

compared to:

 if (num.isIntegral()) {
     long l = num.getLongValue();
 } else {
     BigDecimal bd = num.getBigDecimalValue();
 }

If there are no objections, I will fix this one. Remove the NumberType enum, and JsonNumber#isIntegral() method. Also, need to add a similar method (may be JsonParser#isIntegralNumber) on JsonParser. I circulate the PFD draft2 with this change.

Jitu



[json-processing-spec users] Re: BigDecimal for equals()/hashCode()

Jitendra Kotamraju 02/08/2013

<Possible follow-up(s)>

[json-processing-spec users] Re: BigDecimal for equals()/hashCode()

Jitendra Kotamraju 02/11/2013

[json-processing-spec users] Re: BigDecimal for equals()/hashCode()

Jörn Horstmann 02/13/2013

[json-processing-spec users] Re: BigDecimal for equals()/hashCode()

Jonathan Fuerth 02/13/2013

[json-processing-spec users] Re: BigDecimal for equals()/hashCode()

Jitendra Kotamraju 02/13/2013

[json-processing-spec users] Re: BigDecimal for equals()/hashCode()

Jonathan Fuerth 02/13/2013
 
 
Close
loading
Please Confirm
Close