Ejemplo n.º 1
0
 public JsonNumber.NumberType getNumberType() {
   if (currentEvent != Event.VALUE_NUMBER) {
     throw new IllegalStateException(
         "JsonParser#getNumberType() is valid only "
             + "VALUE_NUMBER parser state. "
             + "But current parser state is "
             + currentEvent);
   }
   BigDecimal bigDecimal = new BigDecimal(tokenizer.getValue());
   return bigDecimal.scale() == 0 ? JsonNumber.NumberType.INTEGER : JsonNumber.NumberType.DECIMAL;
 }
Ejemplo n.º 2
0
 @Override
 public BigDecimal getBigDecimalValue() {
   if (currentEvent != Event.VALUE_NUMBER) {
     throw new IllegalStateException(
         "JsonParser#getNumberType() is valid only "
             + "VALUE_NUMBER parser state. "
             + "But current parser state is "
             + currentEvent);
   }
   return new BigDecimal(tokenizer.getValue());
 }
Ejemplo n.º 3
0
 public String getString() {
   if (currentEvent == Event.KEY_NAME
       || currentEvent == Event.VALUE_STRING
       || currentEvent == Event.VALUE_NUMBER) {
     return tokenizer.getValue();
   }
   throw new IllegalStateException(
       "JsonParser#getString() is valid only "
           + "KEY_NAME, VALUE_STRING, VALUE_NUMBER parser states. "
           + "But current parser state is "
           + currentEvent);
 }