|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectorg.codehaus.jackson.JsonParser
org.codehaus.jackson.impl.JsonParserBase
org.codehaus.jackson.impl.JsonNumericParserBase
public abstract class JsonNumericParserBase
Another intermediate base class used by all Jackson JsonParser
implementations. Contains shared functionality for dealing with
number parsing aspects, independent of input source decoding.
Nested Class Summary |
---|
Nested classes/interfaces inherited from class org.codehaus.jackson.JsonParser |
---|
JsonParser.Feature, JsonParser.NumberType |
Field Summary | |
---|---|
protected BigDecimal |
_numberBigDecimal
|
protected BigInteger |
_numberBigInt
|
protected double |
_numberDouble
|
protected int |
_numberInt
|
protected long |
_numberLong
|
protected boolean |
_numberNegative
Flag that indicates whether numeric value has a negative value. |
protected int |
_numTypesValid
Bitfield that indicates which numeric representations have been calculated for the current type |
protected static char |
CHAR_NULL
|
protected static int |
INT_0
|
protected static int |
INT_1
|
protected static int |
INT_2
|
protected static int |
INT_3
|
protected static int |
INT_4
|
protected static int |
INT_5
|
protected static int |
INT_6
|
protected static int |
INT_7
|
protected static int |
INT_8
|
protected static int |
INT_9
|
protected static int |
INT_DECIMAL_POINT
|
protected static int |
INT_e
|
protected static int |
INT_E
|
protected static int |
INT_MINUS
|
protected static int |
INT_PLUS
|
protected int |
mExpLength
Length of the exponent part of the number, if any, not including 'e' marker or sign, just digits. |
protected int |
mFractLength
Length of the fractional part (not including decimal point or exponent), in characters. |
protected int |
mIntLength
Length of integer part of the number, in characters |
protected static int |
NR_BIGDECIMAL
|
protected static int |
NR_BIGINT
|
protected static int |
NR_DOUBLE
|
protected static int |
NR_INT
|
protected static int |
NR_LONG
|
protected static int |
NR_UNKNOWN
|
Fields inherited from class org.codehaus.jackson.impl.JsonParserBase |
---|
_binaryValue, _closed, _currInputProcessed, _currInputRow, _currInputRowStart, _inputEnd, _inputPtr, _ioContext, _nameCopied, _nameCopyBuffer, _nextToken, _parsingContext, _textBuffer, _tokenIncomplete, _tokenInputCol, _tokenInputRow, _tokenInputTotal |
Fields inherited from class org.codehaus.jackson.JsonParser |
---|
_currToken, _features, _lastClearedToken |
Constructor Summary | |
---|---|
protected |
JsonNumericParserBase(IOContext ctxt,
int features)
|
Method Summary | |
---|---|
protected void |
convertNumberToBigDecimal()
|
protected void |
convertNumberToBigInteger()
|
protected void |
convertNumberToDouble()
|
protected void |
convertNumberToInt()
|
protected void |
convertNumberToLong()
|
BigInteger |
getBigIntegerValue()
Numeric accessor that can be called when the current token is of type JsonToken.VALUE_NUMBER_INT and
it can not be used as a Java long primitive type due to its
magnitude. |
BigDecimal |
getDecimalValue()
Numeric accessor that can be called when the current token is of type JsonToken.VALUE_NUMBER_FLOAT or
JsonToken.VALUE_NUMBER_INT . |
double |
getDoubleValue()
Numeric accessor that can be called when the current token is of type JsonToken.VALUE_NUMBER_FLOAT and
it can be expressed as a Java double primitive type. |
float |
getFloatValue()
Numeric accessor that can be called when the current token is of type JsonToken.VALUE_NUMBER_FLOAT and
it can be expressed as a Java float primitive type. |
int |
getIntValue()
Numeric accessor that can be called when the current token is of type JsonToken.VALUE_NUMBER_INT and
it can be expressed as a value of Java int primitive type. |
long |
getLongValue()
Numeric accessor that can be called when the current token is of type JsonToken.VALUE_NUMBER_INT and
it can be expressed as a Java long primitive type. |
JsonParser.NumberType |
getNumberType()
If current token is of type JsonToken.VALUE_NUMBER_INT or
JsonToken.VALUE_NUMBER_FLOAT , returns
one of JsonParser.NumberType constants; otherwise returns null. |
Number |
getNumberValue()
Generic number value accessor method that will work for all kinds of numeric values. |
protected abstract JsonToken |
parseNumberText(int ch)
|
protected void |
parseNumericValue(int expType)
Method that will parse actual numeric value out of a syntactically valid number value. |
protected void |
reportInvalidNumber(String msg)
|
protected void |
reportOverflowInt()
|
protected void |
reportOverflowLong()
|
protected void |
reportUnexpectedNumberChar(int ch,
String comment)
|
protected JsonToken |
reset(boolean negative,
int intLen,
int fractLen,
int expLen)
|
Methods inherited from class org.codehaus.jackson.JsonParser |
---|
_constructError, clearCurrentToken, configure, disable, disableFeature, enable, enableFeature, getBinaryValue, getBooleanValue, getByteValue, getCodec, getCurrentToken, getEmbeddedObject, getLastClearedToken, getShortValue, hasCurrentToken, isEnabled, isFeatureEnabled, nextValue, readValueAs, readValueAs, readValueAsTree, setCodec, setFeature |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
protected static final int NR_UNKNOWN
protected static final int NR_INT
protected static final int NR_LONG
protected static final int NR_BIGINT
protected static final int NR_DOUBLE
protected static final int NR_BIGDECIMAL
protected static final int INT_0
protected static final int INT_1
protected static final int INT_2
protected static final int INT_3
protected static final int INT_4
protected static final int INT_5
protected static final int INT_6
protected static final int INT_7
protected static final int INT_8
protected static final int INT_9
protected static final int INT_MINUS
protected static final int INT_PLUS
protected static final int INT_DECIMAL_POINT
protected static final int INT_e
protected static final int INT_E
protected static final char CHAR_NULL
protected int _numTypesValid
protected int _numberInt
protected long _numberLong
protected double _numberDouble
protected BigInteger _numberBigInt
protected BigDecimal _numberBigDecimal
protected boolean _numberNegative
protected int mIntLength
protected int mFractLength
protected int mExpLength
Constructor Detail |
---|
protected JsonNumericParserBase(IOContext ctxt, int features)
Method Detail |
---|
protected final JsonToken reset(boolean negative, int intLen, int fractLen, int expLen)
protected abstract JsonToken parseNumberText(int ch) throws IOException, JsonParseException
IOException
JsonParseException
public Number getNumberValue() throws IOException, JsonParseException
JsonParser
getNumberValue
in class JsonParser
IOException
JsonParseException
public JsonParser.NumberType getNumberType() throws IOException, JsonParseException
JsonParser
JsonToken.VALUE_NUMBER_INT
or
JsonToken.VALUE_NUMBER_FLOAT
, returns
one of JsonParser.NumberType
constants; otherwise returns null.
getNumberType
in class JsonParser
IOException
JsonParseException
public int getIntValue() throws IOException, JsonParseException
JsonParser
JsonToken.VALUE_NUMBER_INT
and
it can be expressed as a value of Java int primitive type.
It can also be called for JsonToken.VALUE_NUMBER_FLOAT
;
if so, it is equivalent to calling JsonParser.getDoubleValue()
and then casting; except for possible overflow/underflow
exception.
Note: if the resulting integer value falls outside range of
Java int, a JsonParseException
may be thrown to indicate numeric overflow/underflow.
getIntValue
in class JsonParser
IOException
JsonParseException
public long getLongValue() throws IOException, JsonParseException
JsonParser
JsonToken.VALUE_NUMBER_INT
and
it can be expressed as a Java long primitive type.
It can also be called for JsonToken.VALUE_NUMBER_FLOAT
;
if so, it is equivalent to calling JsonParser.getDoubleValue()
and then casting to int; except for possible overflow/underflow
exception.
Note: if the token is an integer, but its value falls
outside of range of Java long, a JsonParseException
may be thrown to indicate numeric overflow/underflow.
getLongValue
in class JsonParser
IOException
JsonParseException
public BigInteger getBigIntegerValue() throws IOException, JsonParseException
JsonParser
JsonToken.VALUE_NUMBER_INT
and
it can not be used as a Java long primitive type due to its
magnitude.
It can also be called for JsonToken.VALUE_NUMBER_FLOAT
;
if so, it is equivalent to calling JsonParser.getDecimalValue()
and then constructing a BigInteger
from that value.
getBigIntegerValue
in class JsonParser
IOException
JsonParseException
public float getFloatValue() throws IOException, JsonParseException
JsonParser
JsonToken.VALUE_NUMBER_FLOAT
and
it can be expressed as a Java float primitive type.
It can also be called for JsonToken.VALUE_NUMBER_INT
;
if so, it is equivalent to calling JsonParser.getLongValue()
and then casting; except for possible overflow/underflow
exception.
Note: if the value falls
outside of range of Java float, a JsonParseException
will be thrown to indicate numeric overflow/underflow.
getFloatValue
in class JsonParser
IOException
JsonParseException
public double getDoubleValue() throws IOException, JsonParseException
JsonParser
JsonToken.VALUE_NUMBER_FLOAT
and
it can be expressed as a Java double primitive type.
It can also be called for JsonToken.VALUE_NUMBER_INT
;
if so, it is equivalent to calling JsonParser.getLongValue()
and then casting; except for possible overflow/underflow
exception.
Note: if the value falls
outside of range of Java double, a JsonParseException
will be thrown to indicate numeric overflow/underflow.
getDoubleValue
in class JsonParser
IOException
JsonParseException
public BigDecimal getDecimalValue() throws IOException, JsonParseException
JsonParser
JsonToken.VALUE_NUMBER_FLOAT
or
JsonToken.VALUE_NUMBER_INT
. No under/overflow exceptions
are ever thrown.
getDecimalValue
in class JsonParser
IOException
JsonParseException
protected final void parseNumericValue(int expType) throws JsonParseException
expType
- Numeric type that we will immediately need, if any;
mostly necessary to optimize handling of floating point numbers
JsonParseException
protected void convertNumberToInt() throws IOException, JsonParseException
IOException
JsonParseException
protected void convertNumberToLong() throws IOException, JsonParseException
IOException
JsonParseException
protected void convertNumberToBigInteger() throws IOException, JsonParseException
IOException
JsonParseException
protected void convertNumberToDouble() throws IOException, JsonParseException
IOException
JsonParseException
protected void convertNumberToBigDecimal() throws IOException, JsonParseException
IOException
JsonParseException
protected void reportUnexpectedNumberChar(int ch, String comment) throws JsonParseException
JsonParseException
protected void reportInvalidNumber(String msg) throws JsonParseException
JsonParseException
protected void reportOverflowInt() throws IOException, JsonParseException
IOException
JsonParseException
protected void reportOverflowLong() throws IOException, JsonParseException
IOException
JsonParseException
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |