當前位置: 首頁>>代碼示例>>Java>>正文


Java JsonParser.getValueAsLong方法代碼示例

本文整理匯總了Java中com.fasterxml.jackson.core.JsonParser.getValueAsLong方法的典型用法代碼示例。如果您正苦於以下問題:Java JsonParser.getValueAsLong方法的具體用法?Java JsonParser.getValueAsLong怎麽用?Java JsonParser.getValueAsLong使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在com.fasterxml.jackson.core.JsonParser的用法示例。


在下文中一共展示了JsonParser.getValueAsLong方法的8個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。

示例1: parseField

import com.fasterxml.jackson.core.JsonParser; //導入方法依賴的package包/類
@Override
protected void parseField(String fieldName, JsonParser parser) throws IOException {
    switch (fieldName) {
        case "trade_id":
            parser.nextToken();
            tradeId = parser.getValueAsLong();
            break;
        case "maker_order_id":
            parser.nextToken();
            makerOrderId = parser.getValueAsString();
            break;
        case "taker_order_id":
            parser.nextToken();
            takerOrderId = parser.getValueAsString();
            break;
        case "size":
            parser.nextToken();
            size = new BigDecimal(parser.getValueAsString());
            break;
        default:
            break;
    }
}
 
開發者ID:cloudwall,項目名稱:libcwfincore,代碼行數:24,代碼來源:MutableOrderMatchEvent.java

示例2: readRecord

import com.fasterxml.jackson.core.JsonParser; //導入方法依賴的package包/類
Map<String, Object> readRecord(JsonParser jp) throws IOException {

        Map<String, Object> record = new HashMap<>();
        String fielName =  "";
        Object value;
        JsonToken token;

        while((token = jp.nextToken()) != JsonToken.END_OBJECT) {
            if (token == JsonToken.FIELD_NAME) {
                fielName = jp.getCurrentName();
            } else if (token == JsonToken.VALUE_STRING) {
                value = jp.getValueAsString();
                record.put(fielName, value);
            } else if (token == JsonToken.VALUE_NUMBER_INT) {
                value = jp.getValueAsLong();
                record.put(fielName, value);
            }
        }

        //System.out.println(record.toString());
        return record;
    }
 
開發者ID:claudiodegio,項目名稱:dbsync,代碼行數:23,代碼來源:JsonDatabaseReader.java

示例3: parseField

import com.fasterxml.jackson.core.JsonParser; //導入方法依賴的package包/類
@Override
public void parseField(SimpleGenericModel<T> instance, String fieldName, JsonParser jsonParser) throws IOException {
  if ("date".equals(fieldName)) {
    instance.date = getjava_util_Date_type_converter().parse(jsonParser);
  } else if ("string".equals(fieldName)) {
    instance.string = jsonParser.getValueAsString(null);
  } else if ("test_double".equals(fieldName)) {
    instance.testDouble = jsonParser.getValueAsDouble();
  } else if ("test_double_obj".equals(fieldName)) {
    instance.testDoubleObj = jsonParser.getCurrentToken() == JsonToken.VALUE_NULL ? null : Double.valueOf(jsonParser.getValueAsDouble());
  } else if ("test_float".equals(fieldName)) {
    instance.testFloat = (float)jsonParser.getValueAsDouble();
  } else if ("test_float_obj".equals(fieldName)) {
    instance.testFloatObj = jsonParser.getCurrentToken() == JsonToken.VALUE_NULL ? null : new Float(jsonParser.getValueAsDouble());
  } else if ("test_int".equals(fieldName)) {
    instance.testInt = jsonParser.getValueAsInt();
  } else if ("test_int_obj".equals(fieldName)) {
    instance.testIntObj = jsonParser.getCurrentToken() == JsonToken.VALUE_NULL ? null : Integer.valueOf(jsonParser.getValueAsInt());
  } else if ("test_long".equals(fieldName)) {
    instance.testLong = jsonParser.getValueAsLong();
  } else if ("test_long_obj".equals(fieldName)) {
    instance.testLongObj = jsonParser.getCurrentToken() == JsonToken.VALUE_NULL ? null : Long.valueOf(jsonParser.getValueAsLong());
  } else if ("test_string".equals(fieldName)) {
    instance.testString = jsonParser.getValueAsString(null);
  } else if ("test_t".equals(fieldName)) {
    instance.testT = m84ClassJsonMapper.parse(jsonParser);
  }
}
 
開發者ID:weiwenqiang,項目名稱:GitHub,代碼行數:29,代碼來源:SimpleGenericModel$$JsonObjectMapper.java

示例4: parseField

import com.fasterxml.jackson.core.JsonParser; //導入方法依賴的package包/類
@Override
public void parseField(MultipleFieldNamesModel instance, String fieldName, JsonParser jsonParser) throws IOException {
    if ("possible_double_name_1".equals(fieldName) || "possible_double_name_2".equals(fieldName)) {
        instance.testDouble = jsonParser.getValueAsDouble();
    } else if ("possible_float_name_1".equals(fieldName) || "possible_float_name_2".equals(fieldName)){
        instance.testFloat = (float)jsonParser.getValueAsDouble();
    } else if ("possible_int_name_1".equals(fieldName) || "possible_int_name_2".equals(fieldName)){
        instance.testInt = jsonParser.getValueAsInt();
    } else if ("possible_long_name_1".equals(fieldName) || "possible_long_name_2".equals(fieldName)){
        instance.testLong = jsonParser.getValueAsLong();
    } else if ("possible_string_name_1".equals(fieldName) || "possible_string_name_2".equals(fieldName)){
        instance.testString = jsonParser.getValueAsString(null);
    }
}
 
開發者ID:weiwenqiang,項目名稱:GitHub,代碼行數:15,代碼來源:MultipleFieldNamesModel$$JsonObjectMapper.java

示例5: parseField

import com.fasterxml.jackson.core.JsonParser; //導入方法依賴的package包/類
@Override
public void parseField(SimpleGenericModelWithExtends<T> instance, String fieldName, JsonParser jsonParser) throws IOException {
  if ("date".equals(fieldName)) {
    instance.date = getjava_util_Date_type_converter().parse(jsonParser);
  } else if ("string".equals(fieldName)) {
    instance.string = jsonParser.getValueAsString(null);
  } else if ("test_double".equals(fieldName)) {
    instance.testDouble = jsonParser.getValueAsDouble();
  } else if ("test_double_obj".equals(fieldName)) {
    instance.testDoubleObj = jsonParser.getCurrentToken() == JsonToken.VALUE_NULL ? null : Double.valueOf(jsonParser.getValueAsDouble());
  } else if ("test_float".equals(fieldName)) {
    instance.testFloat = (float)jsonParser.getValueAsDouble();
  } else if ("test_float_obj".equals(fieldName)) {
    instance.testFloatObj = jsonParser.getCurrentToken() == JsonToken.VALUE_NULL ? null : new Float(jsonParser.getValueAsDouble());
  } else if ("test_int".equals(fieldName)) {
    instance.testInt = jsonParser.getValueAsInt();
  } else if ("test_int_obj".equals(fieldName)) {
    instance.testIntObj = jsonParser.getCurrentToken() == JsonToken.VALUE_NULL ? null : Integer.valueOf(jsonParser.getValueAsInt());
  } else if ("test_long".equals(fieldName)) {
    instance.testLong = jsonParser.getValueAsLong();
  } else if ("test_long_obj".equals(fieldName)) {
    instance.testLongObj = jsonParser.getCurrentToken() == JsonToken.VALUE_NULL ? null : Long.valueOf(jsonParser.getValueAsLong());
  } else if ("test_string".equals(fieldName)) {
    instance.testString = jsonParser.getValueAsString(null);
  } else if ("test_t".equals(fieldName)) {
    instance.testT = m84ClassJsonMapper.parse(jsonParser);
  }
}
 
開發者ID:weiwenqiang,項目名稱:GitHub,代碼行數:29,代碼來源:SimpleGenericModelWithExtends$$JsonObjectMapper.java

示例6: parseField

import com.fasterxml.jackson.core.JsonParser; //導入方法依賴的package包/類
@Override
public void parseField(BaseModel<T> instance, String fieldName, JsonParser jsonParser) throws IOException {
    if ("createTime".equals(fieldName)) {
        instance.createTime = jsonParser.getValueAsLong();
    } else if ("data".equals(fieldName)) {
        instance.data = mClassJsonMapper.parse(jsonParser);
    } else if ("expire".equals(fieldName)) {
        instance.expire = jsonParser.getValueAsLong();
    } else if ("expireTime".equals(fieldName)) {
        instance.expireTime = jsonParser.getValueAsLong();
    } else if ("updateTime".equals(fieldName)) {
        instance.updateTime = jsonParser.getValueAsLong();
    }
}
 
開發者ID:xuehuayous,項目名稱:Hannibai,代碼行數:15,代碼來源:BaseModel$$JsonObjectMapper.java

示例7: jsonToColumnValue

import com.fasterxml.jackson.core.JsonParser; //導入方法依賴的package包/類
@Override
public Value jsonToColumnValue(final JsonParser parser, final ValueMetadata metadata) throws IOException {

    JsonToken token;
    Value value;

    // Go to the next token
    token = parser.nextToken();

    if (token != JsonToken.VALUE_NUMBER_INT && token != JsonToken.VALUE_NULL) {
        throw new IOException("Unable to parse field " + metadata.getName() + " expected int or null at line " + parser.getCurrentLocation().getLineNr());
    }

    // Can be a integer or null
    if (token == JsonToken.VALUE_NUMBER_INT) {
        value = new Value(parser.getValueAsLong(), metadata);
    } else {
        // null
        if (metadata.isNotNull()) {
            throw new IOException("Unable to parse field " + metadata.getName() + " expected int bu found null at line " + parser.getCurrentLocation().getLineNr());
        }

        value = new Value(metadata);
    }

    return value;
}
 
開發者ID:claudiodegio,項目名稱:dbsync,代碼行數:28,代碼來源:JSonLongConverter.java

示例8: parseFieldName

import com.fasterxml.jackson.core.JsonParser; //導入方法依賴的package包/類
private static void parseFieldName(JsonParser jsonParser, DeserializationContext deserializationContext,
                                   JsonParsingContext parsingContext) throws IOException {
    switch (jsonParser.getCurrentName()) {
        case NodeInfoJsonSerializer.ID:
            jsonParser.nextToken();
            parsingContext.id = jsonParser.getValueAsString();
            break;

        case NodeInfoJsonSerializer.NAME:
            jsonParser.nextToken();
            parsingContext.name = jsonParser.getValueAsString();
            break;

        case NodeInfoJsonSerializer.PSEUDO_CLASS:
            jsonParser.nextToken();
            parsingContext.pseudoClass = jsonParser.getValueAsString();
            break;

        case NodeInfoJsonSerializer.DESCRIPTION:
            jsonParser.nextToken();
            parsingContext.description = jsonParser.getValueAsString();
            break;

        case NodeInfoJsonSerializer.CREATION_TIME:
            jsonParser.nextToken();
            parsingContext.creationTime = jsonParser.getValueAsLong();
            break;

        case NodeInfoJsonSerializer.MODIFICATION_TIME:
            jsonParser.nextToken();
            parsingContext.modificationTime = jsonParser.getValueAsLong();
            break;

        case NodeInfoJsonSerializer.VERSION:
            jsonParser.nextToken();
            parsingContext.version = jsonParser.getValueAsInt();
            break;

        case NodeInfoJsonSerializer.METADATA:
            jsonParser.nextToken();
            parsingContext.metadata = new NodeGenericMetadataJsonDeserializer().deserialize(jsonParser, deserializationContext);
            break;

        default:
            throw new AssertionError("Unexpected field: " + jsonParser.getCurrentName());

    }
}
 
開發者ID:powsybl,項目名稱:powsybl-core,代碼行數:49,代碼來源:NodeInfoJsonDeserializer.java


注:本文中的com.fasterxml.jackson.core.JsonParser.getValueAsLong方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。