public Date parse(String paramString, ParsePosition paramParsePosition) { if (looksLikeISO8601(paramString)) return parseAsISO8601(paramString, paramParsePosition); int i = paramString.length(); int j; do { i--; if (i < 0) break; j = paramString.charAt(i); } while ((j >= 48) && (j <= 57)); if ((i < 0) && (NumberInput.inLongRange(paramString, false))) return new Date(Long.parseLong(paramString)); return parseAsRFC1123(paramString, paramParsePosition); }
private final void _parseSlowIntValue(int paramInt1, char[] paramArrayOfChar, int paramInt2, int paramInt3) throws IOException, JsonParseException { String str = this._textBuffer.contentsAsString(); try { if (NumberInput.inLongRange(paramArrayOfChar, paramInt2, paramInt3, this._numberNegative)) { this._numberLong = Long.parseLong(str); this._numTypesValid = 2; return; } this._numberBigInt = new BigInteger(str); this._numTypesValid = 4; return; } catch (NumberFormatException localNumberFormatException) { _wrapError("Malformed numeric value '" + str + "'", localNumberFormatException); } }
public Date parse(String dateStr, ParsePosition pos) { if (looksLikeISO8601(dateStr)) { // also includes "plain" return parseAsISO8601(dateStr, pos); } /* 14-Feb-2010, tatu: As per [JACKSON-236], better also * consider "stringified" simple time stamp */ int i = dateStr.length(); while (--i >= 0) { char ch = dateStr.charAt(i); if (ch < '0' || ch > '9') break; } if (i < 0) { // all digits if (NumberInput.inLongRange(dateStr, false)) { return new Date(Long.parseLong(dateStr)); } } // Otherwise, fall back to using RFC 1123 return parseAsRFC1123(dateStr, pos); }
protected final Long _parseLong(JsonParser paramJsonParser, DeserializationContext paramDeserializationContext) { JsonToken localJsonToken = paramJsonParser.getCurrentToken(); if ((localJsonToken == JsonToken.VALUE_NUMBER_INT) || (localJsonToken == JsonToken.VALUE_NUMBER_FLOAT)) return Long.valueOf(paramJsonParser.getLongValue()); if (localJsonToken == JsonToken.VALUE_STRING) { String str = paramJsonParser.getText().trim(); if (str.length() == 0) return (Long)getEmptyValue(); try { Long localLong = Long.valueOf(NumberInput.parseLong(str)); return localLong; } catch (IllegalArgumentException localIllegalArgumentException) { throw paramDeserializationContext.weirdStringException(this._valueClass, "not a valid Long value"); } } if (localJsonToken == JsonToken.VALUE_NULL) return (Long)getNullValue(); throw paramDeserializationContext.mappingException(this._valueClass, localJsonToken); }
protected final Long _parseLong(JsonParser paramJsonParser, DeserializationContext paramDeserializationContext) throws IOException, JsonProcessingException { JsonToken localJsonToken1 = paramJsonParser.getCurrentToken(); Long localLong1; if ((localJsonToken1 == JsonToken.VALUE_NUMBER_INT) || (localJsonToken1 == JsonToken.VALUE_NUMBER_FLOAT)) localLong1 = Long.valueOf(paramJsonParser.getLongValue()); JsonToken localJsonToken2; do { while (true) { return localLong1; if (localJsonToken1 != JsonToken.VALUE_STRING) break; String str = paramJsonParser.getText().trim(); int i = str.length(); localLong1 = null; if (i == 0) continue; try { Long localLong2 = Long.valueOf(NumberInput.parseLong(str)); return localLong2; } catch (IllegalArgumentException localIllegalArgumentException) { throw paramDeserializationContext.weirdStringException(this._valueClass, "not a valid Long value"); } } localJsonToken2 = JsonToken.VALUE_NULL; localLong1 = null; } while (localJsonToken1 == localJsonToken2); throw paramDeserializationContext.mappingException(this._valueClass); }
protected final long _parseLongPrimitive(JsonParser paramJsonParser, DeserializationContext paramDeserializationContext) throws IOException, JsonProcessingException { long l1 = 0L; JsonToken localJsonToken = paramJsonParser.getCurrentToken(); if ((localJsonToken == JsonToken.VALUE_NUMBER_INT) || (localJsonToken == JsonToken.VALUE_NUMBER_FLOAT)) l1 = paramJsonParser.getLongValue(); do while (true) { return l1; if (localJsonToken != JsonToken.VALUE_STRING) break; String str = paramJsonParser.getText().trim(); if (str.length() == 0) continue; try { long l2 = NumberInput.parseLong(str); return l2; } catch (IllegalArgumentException localIllegalArgumentException) { throw paramDeserializationContext.weirdStringException(this._valueClass, "not a valid long value"); } } while (localJsonToken == JsonToken.VALUE_NULL); throw paramDeserializationContext.mappingException(this._valueClass); }
protected Byte _parseByte(JsonParser paramJsonParser, DeserializationContext paramDeserializationContext) { JsonToken localJsonToken = paramJsonParser.getCurrentToken(); if ((localJsonToken == JsonToken.VALUE_NUMBER_INT) || (localJsonToken == JsonToken.VALUE_NUMBER_FLOAT)) return Byte.valueOf(paramJsonParser.getByteValue()); if (localJsonToken == JsonToken.VALUE_STRING) { String str = paramJsonParser.getText().trim(); int i; try { if (str.length() == 0) return (Byte)getEmptyValue(); i = NumberInput.parseInt(str); if ((i < -128) || (i > 127)) throw paramDeserializationContext.weirdStringException(this._valueClass, "overflow, value can not be represented as 8-bit value"); } catch (IllegalArgumentException localIllegalArgumentException) { throw paramDeserializationContext.weirdStringException(this._valueClass, "not a valid Byte value"); } return Byte.valueOf((byte)i); } if (localJsonToken == JsonToken.VALUE_NULL) return (Byte)getNullValue(); throw paramDeserializationContext.mappingException(this._valueClass, localJsonToken); }
protected final Integer _parseInteger(JsonParser paramJsonParser, DeserializationContext paramDeserializationContext) { JsonToken localJsonToken = paramJsonParser.getCurrentToken(); if ((localJsonToken == JsonToken.VALUE_NUMBER_INT) || (localJsonToken == JsonToken.VALUE_NUMBER_FLOAT)) return Integer.valueOf(paramJsonParser.getIntValue()); if (localJsonToken == JsonToken.VALUE_STRING) { String str = paramJsonParser.getText().trim(); int i; long l; try { i = str.length(); if (i <= 9) break label139; l = Long.parseLong(str); if ((l < -2147483648L) || (l > 2147483647L)) throw paramDeserializationContext.weirdStringException(this._valueClass, "Overflow: numeric value (" + str + ") out of range of Integer (-2147483648 - 2147483647)"); } catch (IllegalArgumentException localIllegalArgumentException) { throw paramDeserializationContext.weirdStringException(this._valueClass, "not a valid Integer value"); } int j = (int)l; return Integer.valueOf(j); label139: if (i == 0) return (Integer)getEmptyValue(); Integer localInteger = Integer.valueOf(NumberInput.parseInt(str)); return localInteger; } if (localJsonToken == JsonToken.VALUE_NULL) return (Integer)getNullValue(); throw paramDeserializationContext.mappingException(this._valueClass, localJsonToken); }
protected final long _parseLongPrimitive(JsonParser paramJsonParser, DeserializationContext paramDeserializationContext) { long l1 = 0L; JsonToken localJsonToken = paramJsonParser.getCurrentToken(); if ((localJsonToken == JsonToken.VALUE_NUMBER_INT) || (localJsonToken == JsonToken.VALUE_NUMBER_FLOAT)) l1 = paramJsonParser.getLongValue(); do { String str; do { return l1; if (localJsonToken != JsonToken.VALUE_STRING) break; str = paramJsonParser.getText().trim(); } while (str.length() == 0); try { long l2 = NumberInput.parseLong(str); return l2; } catch (IllegalArgumentException localIllegalArgumentException) { throw paramDeserializationContext.weirdStringException(this._valueClass, "not a valid long value"); } } while (localJsonToken == JsonToken.VALUE_NULL); throw paramDeserializationContext.mappingException(this._valueClass, localJsonToken); }
protected Short _parseShort(JsonParser paramJsonParser, DeserializationContext paramDeserializationContext) { JsonToken localJsonToken = paramJsonParser.getCurrentToken(); if ((localJsonToken == JsonToken.VALUE_NUMBER_INT) || (localJsonToken == JsonToken.VALUE_NUMBER_FLOAT)) return Short.valueOf(paramJsonParser.getShortValue()); if (localJsonToken == JsonToken.VALUE_STRING) { String str = paramJsonParser.getText().trim(); int i; try { if (str.length() == 0) return (Short)getEmptyValue(); i = NumberInput.parseInt(str); if ((i < -32768) || (i > 32767)) throw paramDeserializationContext.weirdStringException(this._valueClass, "overflow, value can not be represented as 16-bit value"); } catch (IllegalArgumentException localIllegalArgumentException) { throw paramDeserializationContext.weirdStringException(this._valueClass, "not a valid Short value"); } return Short.valueOf((short)i); } if (localJsonToken == JsonToken.VALUE_NULL) return (Short)getNullValue(); throw paramDeserializationContext.mappingException(this._valueClass, localJsonToken); }
protected double _parseDouble(String paramString) throws IllegalArgumentException { return NumberInput.parseDouble(paramString); }
public double contentsAsDouble() throws NumberFormatException { return NumberInput.parseDouble(contentsAsString()); }
protected void _parseNumericValue(int paramInt) throws IOException, JsonParseException { if (this._currToken == JsonToken.VALUE_NUMBER_INT) { char[] arrayOfChar = this._textBuffer.getTextBuffer(); int i = this._textBuffer.getTextOffset(); int j = this._intLength; if (this._numberNegative) i++; if (j <= 9) { int k = NumberInput.parseInt(arrayOfChar, i, j); if (this._numberNegative) k = -k; this._numberInt = k; this._numTypesValid = 1; return; } if (j <= 18) { long l = NumberInput.parseLong(arrayOfChar, i, j); if (this._numberNegative) l = -l; if (j == 10) if (this._numberNegative) { if (l >= -2147483648L) { this._numberInt = (int)l; this._numTypesValid = 1; return; } } else if (l <= 2147483647L) { this._numberInt = (int)l; this._numTypesValid = 1; return; } this._numberLong = l; this._numTypesValid = 2; return; } _parseSlowIntValue(paramInt, arrayOfChar, i, j); return; } if (this._currToken == JsonToken.VALUE_NUMBER_FLOAT) { _parseSlowFloatValue(paramInt); return; } _reportError("Current token (" + this._currToken + ") not numeric, can not use numeric value accessors"); }
public double getValueAsDouble(double paramDouble) { return NumberInput.parseAsDouble(this._value, paramDouble); }
public int getValueAsInt(int paramInt) { return NumberInput.parseAsInt(this._value, paramInt); }
public long getValueAsLong(long paramLong) { return NumberInput.parseAsLong(this._value, paramLong); }
protected double _parseDouble(String paramString) { return NumberInput.parseDouble(paramString); }
public final double contentsAsDouble() { return NumberInput.parseDouble(contentsAsString()); }