Java 类org.codehaus.jackson.JsonParser.NumberType 实例源码

项目:12306-android-Decompile    文件:TokenBuffer.java   
public JsonParser.NumberType getNumberType()
  throws IOException, JsonParseException
{
  Number localNumber = getNumberValue();
  if ((localNumber instanceof Integer))
    return JsonParser.NumberType.INT;
  if ((localNumber instanceof Long))
    return JsonParser.NumberType.LONG;
  if ((localNumber instanceof Double))
    return JsonParser.NumberType.DOUBLE;
  if ((localNumber instanceof BigDecimal))
    return JsonParser.NumberType.BIG_DECIMAL;
  if ((localNumber instanceof Float))
    return JsonParser.NumberType.FLOAT;
  if ((localNumber instanceof BigInteger))
    return JsonParser.NumberType.BIG_INTEGER;
  return null;
}
项目:12306-android-Decompile    文件:JsonNumericParserBase.java   
public JsonParser.NumberType getNumberType()
  throws IOException, JsonParseException
{
  if (this._numTypesValid == 0)
    _parseNumericValue(0);
  if (this._currToken == JsonToken.VALUE_NUMBER_INT)
  {
    if ((0x1 & this._numTypesValid) != 0)
      return JsonParser.NumberType.INT;
    if ((0x2 & this._numTypesValid) != 0)
      return JsonParser.NumberType.LONG;
    return JsonParser.NumberType.BIG_INTEGER;
  }
  if ((0x10 & this._numTypesValid) != 0)
    return JsonParser.NumberType.BIG_DECIMAL;
  return JsonParser.NumberType.DOUBLE;
}
项目:12306-android-Decompile    文件:TokenBuffer.java   
public JsonParser.NumberType getNumberType()
  throws IOException, JsonParseException
{
  Number localNumber = getNumberValue();
  if ((localNumber instanceof Integer))
    return JsonParser.NumberType.INT;
  if ((localNumber instanceof Long))
    return JsonParser.NumberType.LONG;
  if ((localNumber instanceof Double))
    return JsonParser.NumberType.DOUBLE;
  if ((localNumber instanceof BigDecimal))
    return JsonParser.NumberType.BIG_DECIMAL;
  if ((localNumber instanceof Float))
    return JsonParser.NumberType.FLOAT;
  if ((localNumber instanceof BigInteger))
    return JsonParser.NumberType.BIG_INTEGER;
  return null;
}
项目:12306-android-Decompile    文件:JsonNumericParserBase.java   
public JsonParser.NumberType getNumberType()
  throws IOException, JsonParseException
{
  if (this._numTypesValid == 0)
    _parseNumericValue(0);
  if (this._currToken == JsonToken.VALUE_NUMBER_INT)
  {
    if ((0x1 & this._numTypesValid) != 0)
      return JsonParser.NumberType.INT;
    if ((0x2 & this._numTypesValid) != 0)
      return JsonParser.NumberType.LONG;
    return JsonParser.NumberType.BIG_INTEGER;
  }
  if ((0x10 & this._numTypesValid) != 0)
    return JsonParser.NumberType.BIG_DECIMAL;
  return JsonParser.NumberType.DOUBLE;
}
项目:ingress-indonesia-dev    文件:TokenBuffer$Parser.java   
public final JsonParser.NumberType getNumberType()
{
  Number localNumber = getNumberValue();
  if ((localNumber instanceof Integer))
    return JsonParser.NumberType.INT;
  if ((localNumber instanceof Long))
    return JsonParser.NumberType.LONG;
  if ((localNumber instanceof Double))
    return JsonParser.NumberType.DOUBLE;
  if ((localNumber instanceof BigDecimal))
    return JsonParser.NumberType.BIG_DECIMAL;
  if ((localNumber instanceof Float))
    return JsonParser.NumberType.FLOAT;
  if ((localNumber instanceof BigInteger))
    return JsonParser.NumberType.BIG_INTEGER;
  return null;
}
项目:Cubert    文件:JsonUtils.java   
public static Object decodeConstant(JsonNode valNode, String valType)
{
    if (valType != null && valNode.isNumber())
    {
        NumberType numType;
        Number numVal = valNode.getNumberValue();

        if (valType != null)
        {
            numType = NumberType.valueOf(valType.toUpperCase());
            switch (numType)
            {
            case DOUBLE:
                return numVal.doubleValue();
            case FLOAT:
                return numVal.floatValue();
            case INT:
                return numVal.intValue();
            case LONG:
                return numVal.longValue();
            default:
                break;

            }
        }
    }

    return asObject(valNode);
}
项目:12306-android-Decompile    文件:TreeTraversingParser.java   
public JsonParser.NumberType getNumberType()
  throws IOException, JsonParseException
{
  JsonNode localJsonNode = currentNumericNode();
  if (localJsonNode == null)
    return null;
  return localJsonNode.getNumberType();
}
项目:CalcEngine    文件:JsonUtils.java   
public static Object decodeConstant(JsonNode valNode, String valType)
{
    if (valType != null && valNode.isNumber())
    {
        NumberType numType;
        Number numVal = valNode.getNumberValue();

        if (valType != null)
        {
            numType = NumberType.valueOf(valType.toUpperCase());
            switch (numType)
            {
            case DOUBLE:
                return numVal.doubleValue();
            case FLOAT:
                return numVal.floatValue();
            case INT:
                return numVal.intValue();
            case LONG:
                return numVal.longValue();
            default:
                break;

            }
        }
    }

    return asObject(valNode);
}
项目:12306-android-Decompile    文件:TreeTraversingParser.java   
public JsonParser.NumberType getNumberType()
  throws IOException, JsonParseException
{
  JsonNode localJsonNode = currentNumericNode();
  if (localJsonNode == null)
    return null;
  return localJsonNode.getNumberType();
}
项目:gemfirexd-oss    文件:JSONFormatter.java   
private void setNumberField(JsonParser jp, PdxInstanceHelper pih, String fieldName) throws IOException {
  try{
    NumberType nt = jp.getNumberType();

    switch(nt) {
    case BIG_DECIMAL:
      pih.addBigDecimalField(fieldName, jp.getDecimalValue());
      break;
    case BIG_INTEGER: {
      BigInteger bi = jp.getBigIntegerValue();
      pih.addBigIntegerField(fieldName, bi);
    }
      break;
    case DOUBLE:
      pih.addDoubleField(fieldName, jp.getDoubleValue());
      break;
    case FLOAT:
      pih.addFloatField(fieldName, jp.getFloatValue());
      break;
    case INT: {
      int val = jp.getIntValue();
      if (val > Short.MAX_VALUE || val < Short.MIN_VALUE) {
        pih.addIntField(fieldName, val);
      } else if (val > Byte.MAX_VALUE || val < Byte.MIN_VALUE) {
        pih.addShortField(fieldName, (short)val);
      } else {
        pih.addByteField(fieldName, (byte)val);
      }
    }
      break;
    case LONG:
      pih.addLongField(fieldName, jp.getLongValue());
      break;
      default:
        throw new IllegalStateException("setNumberField:unknow number type " + nt);
    }      
  }catch(JsonParseException jpe) {
    throw jpe;
  } catch (IOException e) {
    throw e;
  }
}
项目:gemfirexd-oss    文件:JSONFormatter.java   
private void setNumberField(JsonParser jp, PdxListHelper pih) throws IOException {
  try{
    NumberType nt = jp.getNumberType();

    switch(nt) {
    case BIG_DECIMAL:
      pih.addBigDecimalField(jp.getDecimalValue());
      break;
    case BIG_INTEGER: {
      BigInteger bi = jp.getBigIntegerValue();
      pih.addBigIntegerField(bi);
    }
      break;
    case DOUBLE:
      pih.addDoubleField(jp.getDoubleValue());
      break;
    case FLOAT:
      pih.addFloatField(jp.getFloatValue());
      break;
    case INT: {
      int val = jp.getIntValue();
      if (val > Short.MAX_VALUE || val < Short.MIN_VALUE) {
        pih.addIntField(val);
      } else if (val > Byte.MAX_VALUE || val < Byte.MIN_VALUE) {
        pih.addShortField((short)val);
      } else {
        pih.addByteField((byte)val);
      }
    }
      break;
    case LONG:
      pih.addLongField(jp.getLongValue());
      break;
      default:
        throw new IllegalStateException("setNumberField:unknow number type " + nt);
    }      
  }catch(JsonParseException jpe) {
    throw jpe;
  } catch (IOException e) {
    throw e;
  }
}
项目:gemfirexd-oss    文件:JSONFormatter.java   
private void setNumberField(JsonParser jp, PdxInstanceHelper pih, String fieldName) throws IOException {
  try{
    NumberType nt = jp.getNumberType();

    switch(nt) {
    case BIG_DECIMAL:
      pih.addBigDecimalField(fieldName, jp.getDecimalValue());
      break;
    case BIG_INTEGER: {
      BigInteger bi = jp.getBigIntegerValue();
      pih.addBigIntegerField(fieldName, bi);
    }
      break;
    case DOUBLE:
      pih.addDoubleField(fieldName, jp.getDoubleValue());
      break;
    case FLOAT:
      pih.addFloatField(fieldName, jp.getFloatValue());
      break;
    case INT: {
      int val = jp.getIntValue();
      if (val > Short.MAX_VALUE || val < Short.MIN_VALUE) {
        pih.addIntField(fieldName, val);
      } else if (val > Byte.MAX_VALUE || val < Byte.MIN_VALUE) {
        pih.addShortField(fieldName, (short)val);
      } else {
        pih.addByteField(fieldName, (byte)val);
      }
    }
      break;
    case LONG:
      pih.addLongField(fieldName, jp.getLongValue());
      break;
      default:
        throw new IllegalStateException("setNumberField:unknow number type " + nt);
    }      
  }catch(JsonParseException jpe) {
    throw jpe;
  } catch (IOException e) {
    throw e;
  }
}
项目:gemfirexd-oss    文件:JSONFormatter.java   
private void setNumberField(JsonParser jp, PdxListHelper pih) throws IOException {
  try{
    NumberType nt = jp.getNumberType();

    switch(nt) {
    case BIG_DECIMAL:
      pih.addBigDecimalField(jp.getDecimalValue());
      break;
    case BIG_INTEGER: {
      BigInteger bi = jp.getBigIntegerValue();
      pih.addBigIntegerField(bi);
    }
      break;
    case DOUBLE:
      pih.addDoubleField(jp.getDoubleValue());
      break;
    case FLOAT:
      pih.addFloatField(jp.getFloatValue());
      break;
    case INT: {
      int val = jp.getIntValue();
      if (val > Short.MAX_VALUE || val < Short.MIN_VALUE) {
        pih.addIntField(val);
      } else if (val > Byte.MAX_VALUE || val < Byte.MIN_VALUE) {
        pih.addShortField((short)val);
      } else {
        pih.addByteField((byte)val);
      }
    }
      break;
    case LONG:
      pih.addLongField(jp.getLongValue());
      break;
      default:
        throw new IllegalStateException("setNumberField:unknow number type " + nt);
    }      
  }catch(JsonParseException jpe) {
    throw jpe;
  } catch (IOException e) {
    throw e;
  }
}
项目:12306-android-Decompile    文件:JsonParserDelegate.java   
public JsonParser.NumberType getNumberType()
  throws IOException, JsonParseException
{
  return this.delegate.getNumberType();
}
项目:12306-android-Decompile    文件:LongNode.java   
public JsonParser.NumberType getNumberType()
{
  return JsonParser.NumberType.LONG;
}
项目:12306-android-Decompile    文件:DecimalNode.java   
public JsonParser.NumberType getNumberType()
{
  return JsonParser.NumberType.BIG_DECIMAL;
}
项目:12306-android-Decompile    文件:BigIntegerNode.java   
public JsonParser.NumberType getNumberType()
{
  return JsonParser.NumberType.BIG_INTEGER;
}
项目:12306-android-Decompile    文件:BaseJsonNode.java   
public JsonParser.NumberType getNumberType()
{
  return null;
}
项目:12306-android-Decompile    文件:DoubleNode.java   
public JsonParser.NumberType getNumberType()
{
  return JsonParser.NumberType.DOUBLE;
}
项目:12306-android-Decompile    文件:IntNode.java   
public JsonParser.NumberType getNumberType()
{
  return JsonParser.NumberType.INT;
}
项目:12306-android-Decompile    文件:JsonParserDelegate.java   
public JsonParser.NumberType getNumberType()
  throws IOException, JsonParseException
{
  return this.delegate.getNumberType();
}
项目:12306-android-Decompile    文件:LongNode.java   
public JsonParser.NumberType getNumberType()
{
  return JsonParser.NumberType.LONG;
}
项目:12306-android-Decompile    文件:DecimalNode.java   
public JsonParser.NumberType getNumberType()
{
  return JsonParser.NumberType.BIG_DECIMAL;
}
项目:12306-android-Decompile    文件:BigIntegerNode.java   
public JsonParser.NumberType getNumberType()
{
  return JsonParser.NumberType.BIG_INTEGER;
}
项目:12306-android-Decompile    文件:BaseJsonNode.java   
public JsonParser.NumberType getNumberType()
{
  return null;
}
项目:12306-android-Decompile    文件:DoubleNode.java   
public JsonParser.NumberType getNumberType()
{
  return JsonParser.NumberType.DOUBLE;
}
项目:12306-android-Decompile    文件:IntNode.java   
public JsonParser.NumberType getNumberType()
{
  return JsonParser.NumberType.INT;
}
项目:ingress-indonesia-dev    文件:JsonParserDelegate.java   
public JsonParser.NumberType getNumberType()
{
  return this.delegate.getNumberType();
}
项目:12306-android-Decompile    文件:NumericNode.java   
public abstract JsonParser.NumberType getNumberType();
项目:12306-android-Decompile    文件:NumericNode.java   
public abstract JsonParser.NumberType getNumberType();