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


Java JsonParser.getLongValue方法代碼示例

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


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

示例1: deserialize

import com.fasterxml.jackson.core.JsonParser; //導入方法依賴的package包/類
public static YieldMessage deserialize(JsonParser jp) throws IOException {
	jp.nextToken();
	long request = jp.getLongValue();

	jp.nextToken();
	ParserUtil.readObject(jp);

	List<Object> arguments = null;
	JsonToken token = jp.nextToken();
	if (token == JsonToken.START_ARRAY) {
		arguments = ParserUtil.readArray(jp);
	}

	Map<String, Object> argumentsKw = null;
	token = jp.nextToken();
	if (token == JsonToken.START_OBJECT) {
		argumentsKw = ParserUtil.readObject(jp);
	}

	return new YieldMessage(request, arguments, argumentsKw);
}
 
開發者ID:ralscha,項目名稱:wamp2spring,代碼行數:22,代碼來源:YieldMessage.java

示例2: deserialize

import com.fasterxml.jackson.core.JsonParser; //導入方法依賴的package包/類
public static RegisterMessage deserialize(JsonParser jp) throws IOException {
	jp.nextToken();
	long request = jp.getLongValue();

	boolean discloseCaller = false;
	jp.nextToken();
	Map<String, Object> options = ParserUtil.readObject(jp);
	if (options != null) {
		discloseCaller = (boolean) options.getOrDefault("disclose_caller", false);
	}

	jp.nextToken();
	String procedure = jp.getValueAsString();

	return new RegisterMessage(request, procedure, discloseCaller);
}
 
開發者ID:ralscha,項目名稱:wamp2spring,代碼行數:17,代碼來源:RegisterMessage.java

示例3: deserialize

import com.fasterxml.jackson.core.JsonParser; //導入方法依賴的package包/類
public static RegisteredMessage deserialize(JsonParser jp) throws IOException {
	jp.nextToken();
	long request = jp.getLongValue();

	jp.nextToken();
	long registration = jp.getLongValue();

	return new RegisteredMessage(request, registration);
}
 
開發者ID:ralscha,項目名稱:wamp2spring,代碼行數:10,代碼來源:RegisteredMessage.java

示例4: parse

import com.fasterxml.jackson.core.JsonParser; //導入方法依賴的package包/類
@Override
public Long parse(JsonParser jsonParser) throws IOException {
    if (jsonParser.getCurrentToken() == JsonToken.VALUE_NULL) {
        return null;
    } else {
        return jsonParser.getLongValue();
    }
}
 
開發者ID:weiwenqiang,項目名稱:GitHub,代碼行數:9,代碼來源:LongMapper.java

示例5: parsePerson

import com.fasterxml.jackson.core.JsonParser; //導入方法依賴的package包/類
public static void parsePerson() {
    try {
        JsonFactory jsonfactory = new JsonFactory();
        JsonParser parser = jsonfactory.createParser(new File("Person.json"));
        while (parser.nextToken() != JsonToken.END_OBJECT) {
            String token = parser.getCurrentName();

            if ("firstname".equals(token)) {
                parser.nextToken();
                String fname = parser.getText();
                out.println("firstname : " + fname);
            }
            if ("lastname".equals(token)) {
                parser.nextToken();
                String lname = parser.getText();
                out.println("lastname : " + lname);
            }
            if ("phone".equals(token)) {
                parser.nextToken();
                long phone = parser.getLongValue();
                out.println("phone : " + phone);
            }
            if ("address".equals(token)) {
                out.println("address :");
                parser.nextToken();
                while (parser.nextToken() != JsonToken.END_ARRAY) {
                    out.println(parser.getText());
                }
            }
        }
        parser.close();
    } catch (IOException ex) {
        ex.printStackTrace();
    }
}
 
開發者ID:PacktPublishing,項目名稱:Machine-Learning-End-to-Endguide-for-Java-developers,代碼行數:36,代碼來源:JSONExamples.java

示例6: parsePerson

import com.fasterxml.jackson.core.JsonParser; //導入方法依賴的package包/類
public void parsePerson(JsonParser parser) throws IOException {
    while (parser.nextToken() != JsonToken.END_ARRAY) {
        String token = parser.getCurrentName();
        if ("firstname".equals(token)) {
            parser.nextToken();
            String fname = parser.getText();
            out.println("firstname : " + fname);
        }
        if ("lastname".equals(token)) {
            parser.nextToken();
            String lname = parser.getText();
            out.println("lastname : " + lname);
        }
        if ("phone".equals(token)) {
            parser.nextToken();
            long phone = parser.getLongValue();
            out.println("phone : " + phone);
        }
        if ("address".equals(token)) {
            out.println("address :");
            parser.nextToken();
            while (parser.nextToken() != JsonToken.END_ARRAY) {
                out.println(parser.getText());
            }
        }
    }
}
 
開發者ID:PacktPublishing,項目名稱:Java-Data-Science-Made-Easy,代碼行數:28,代碼來源:JSONExamples.java

示例7: deserialize

import com.fasterxml.jackson.core.JsonParser; //導入方法依賴的package包/類
@Override
public Long deserialize(JsonParser p, DeserializationContext ctxt) throws IOException {
  if (p.hasToken(JsonToken.VALUE_NUMBER_INT)) {
    return p.getLongValue();
  }
  if (p.hasToken(JsonToken.VALUE_STRING)) {
    return Instant.parse(p.getText()).toEpochMilli();
  }

  return 0L;
}
 
開發者ID:mnemonic-no,項目名稱:act-platform,代碼行數:12,代碼來源:TimestampDeserializer.java

示例8: deserialize

import com.fasterxml.jackson.core.JsonParser; //導入方法依賴的package包/類
public static UnsubscribeMessage deserialize(JsonParser jp) throws IOException {
	jp.nextToken();
	long request = jp.getLongValue();

	jp.nextToken();
	long subscription = jp.getLongValue();

	return new UnsubscribeMessage(request, subscription);
}
 
開發者ID:ralscha,項目名稱:wamp2spring,代碼行數:10,代碼來源:UnsubscribeMessage.java

示例9: deserialize

import com.fasterxml.jackson.core.JsonParser; //導入方法依賴的package包/類
public static ErrorMessage deserialize(JsonParser jp) throws IOException {
	jp.nextToken();
	int type = jp.getIntValue();

	jp.nextToken();
	long request = jp.getLongValue();

	jp.nextToken();
	ParserUtil.readObject(jp);

	jp.nextToken();
	String error = jp.getValueAsString();

	List<Object> arguments = null;
	JsonToken token = jp.nextToken();
	if (token == JsonToken.START_ARRAY) {
		arguments = ParserUtil.readArray(jp);
	}

	Map<String, Object> argumentsKw = null;
	token = jp.nextToken();
	if (token == JsonToken.START_OBJECT) {
		argumentsKw = ParserUtil.readObject(jp);
	}

	return new ErrorMessage(type, request, error, arguments, argumentsKw);
}
 
開發者ID:ralscha,項目名稱:wamp2spring,代碼行數:28,代碼來源:ErrorMessage.java

示例10: deserialize

import com.fasterxml.jackson.core.JsonParser; //導入方法依賴的package包/類
public static InvocationMessage deserialize(JsonParser jp) throws IOException {
	jp.nextToken();
	long request = jp.getLongValue();

	jp.nextToken();
	long registration = jp.getLongValue();

	jp.nextToken();
	Number caller = null;
	Map<String, Object> details = ParserUtil.readObject(jp);
	if (details != null) {
		caller = (Number) details.get("caller");
	}

	List<Object> arguments = null;
	JsonToken token = jp.nextToken();
	if (token == JsonToken.START_ARRAY) {
		arguments = ParserUtil.readArray(jp);
	}

	Map<String, Object> argumentsKw = null;
	token = jp.nextToken();
	if (token == JsonToken.START_OBJECT) {
		argumentsKw = ParserUtil.readObject(jp);
	}

	return new InvocationMessage(request, registration, caller, arguments,
			argumentsKw);
}
 
開發者ID:ralscha,項目名稱:wamp2spring,代碼行數:30,代碼來源:InvocationMessage.java

示例11: deserialize

import com.fasterxml.jackson.core.JsonParser; //導入方法依賴的package包/類
public static UnregisterMessage deserialize(JsonParser jp) throws IOException {
	jp.nextToken();
	long request = jp.getLongValue();

	jp.nextToken();
	long registration = jp.getLongValue();

	return new UnregisterMessage(request, registration);
}
 
開發者ID:ralscha,項目名稱:wamp2spring,代碼行數:10,代碼來源:UnregisterMessage.java

示例12: deserialize

import com.fasterxml.jackson.core.JsonParser; //導入方法依賴的package包/類
public static PublishedMessage deserialize(JsonParser jp) throws IOException {
	jp.nextToken();
	long request = jp.getLongValue();

	jp.nextToken();
	long subscription = jp.getLongValue();

	return new PublishedMessage(request, subscription);
}
 
開發者ID:ralscha,項目名稱:wamp2spring,代碼行數:10,代碼來源:PublishedMessage.java

示例13: deserialize

import com.fasterxml.jackson.core.JsonParser; //導入方法依賴的package包/類
public static CallMessage deserialize(JsonParser jp) throws IOException {
	jp.nextToken();
	long request = jp.getLongValue();

	boolean discloseMe = false;
	jp.nextToken();
	Map<String, Object> options = ParserUtil.readObject(jp);
	if (options != null) {
		discloseMe = (boolean) options.getOrDefault("disclose_me", false);
	}

	jp.nextToken();
	String procedure = jp.getValueAsString();

	List<Object> arguments = null;
	JsonToken token = jp.nextToken();
	if (token == JsonToken.START_ARRAY) {
		arguments = ParserUtil.readArray(jp);
	}

	Map<String, Object> argumentsKw = null;
	token = jp.nextToken();
	if (token == JsonToken.START_OBJECT) {
		argumentsKw = ParserUtil.readObject(jp);
	}

	return new CallMessage(request, procedure, arguments, argumentsKw, discloseMe);
}
 
開發者ID:ralscha,項目名稱:wamp2spring,代碼行數:29,代碼來源:CallMessage.java

示例14: deserialize

import com.fasterxml.jackson.core.JsonParser; //導入方法依賴的package包/類
@SuppressWarnings("unchecked")
public static WelcomeMessage deserialize(JsonParser jp) throws IOException {
	jp.nextToken();
	long session = jp.getLongValue();

	List<WampRole> roles = new ArrayList<>();
	String realm = null;
	jp.nextToken();
	Map<String, Object> details = ParserUtil.readObject(jp);
	if (details != null) {
		Map<String, Map<String, Map<String, Boolean>>> rolesMap = (Map<String, Map<String, Map<String, Boolean>>>) details
				.get("roles");
		for (Map.Entry<String, Map<String, Map<String, Boolean>>> entry : rolesMap
				.entrySet()) {
			WampRole wampRole = new WampRole(entry.getKey());
			Map<String, Boolean> features = entry.getValue().get("features");
			if (features != null) {
				for (String feature : features.keySet()) {
					wampRole.addFeature(feature);
				}
			}
			roles.add(wampRole);
		}

		realm = (String) details.get("realm");
	}

	return new WelcomeMessage(session, roles, realm);
}
 
開發者ID:ralscha,項目名稱:wamp2spring,代碼行數:30,代碼來源:WelcomeMessage.java

示例15: parseLong

import com.fasterxml.jackson.core.JsonParser; //導入方法依賴的package包/類
/** Parses a long out of the input, using the optimized path when the value is not quoted. */
private static long parseLong(JsonParser parser) throws IOException {
  if (parser.currentToken() == JsonToken.VALUE_NUMBER_INT) {
    return parser.getLongValue();
  }
  return NumberInput.parseLong(parser.getText());
}
 
開發者ID:curioswitch,項目名稱:curiostack,代碼行數:8,代碼來源:ParseSupport.java


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