Package com.fasterxml.jackson.databind

Examples of com.fasterxml.jackson.databind.JsonNode.asInt()


        Constants.Employment.START_DATE_YEAR)) != null) {
      startDateYear = childNode.asInt();
    }
    if ((childNode = LinkedinAuthUser.traverse(node,
        Constants.Employment.END_DATE_MONTH)) != null) {
      endDateMonth = childNode.asInt();
    }
    if ((childNode = LinkedinAuthUser.traverse(node,
        Constants.Employment.END_DATE_YEAR)) != null) {
      endDateYear = childNode.asInt();
    }
View Full Code Here


        Constants.Employment.END_DATE_MONTH)) != null) {
      endDateMonth = childNode.asInt();
    }
    if ((childNode = LinkedinAuthUser.traverse(node,
        Constants.Employment.END_DATE_YEAR)) != null) {
      endDateYear = childNode.asInt();
    }
    if (node.has(Constants.Employment.IS_CURRENT)) {
      isCurrent = node.get(Constants.Employment.IS_CURRENT).asBoolean();
    }
    if ((childNode = LinkedinAuthUser.traverse(node,
View Full Code Here

    @Override
    public CoinbaseBuySellLevel deserialize(final JsonParser jsonParser, final DeserializationContext ctxt) throws IOException, JsonProcessingException {

      final ObjectCodec oc = jsonParser.getCodec();
      final JsonNode node = oc.readTree(jsonParser);
      final int buySellLevel = node.asInt();
      return FROM_STRING_HELPER.fromJsonString(String.valueOf(buySellLevel));
    }
  }
}
View Full Code Here

        {
            return jsonNode.asLong();
        }
        if( jsonNode.isInt() )
        {
            return jsonNode.asInt();
        }
        if( jsonNode.isBoolean() )
        {
            return jsonNode.asBoolean();
        }
View Full Code Here

    public int status(){
        if (!Type.OBJECT.equals(type))return 200;
        JsonNode node = (JsonNode)data;
        JsonNode status = node.get("status");
        if (status==null||!status.isNumber()) return 200;
        return status.asInt();
    }

    public JsonNode content(){
        if (!Type.OBJECT.equals(type))return TextNode.valueOf("");
        JsonNode node = (JsonNode)data;
View Full Code Here

    JsonNode json = om.readTree(content);
    JsonNode root = JsonTree.read(json, pp);
    if(root.isMissingNode()){
      fail();
    }else{
      assertEquals(1,root.asInt());
    }
  }

  @Test
  public void readValueFromNonExistentSimpleField() throws Exception {
View Full Code Here

      JsonNode bodyJson= body.asJson();
      JsonNode newDBAlert = bodyJson.get(BBConfiguration.DB_ALERT_THRESHOLD);
      JsonNode newDBSize = bodyJson.get(BBConfiguration.DB_SIZE_THRESHOLD);
      try{
        if (newDBAlert!=null && !newDBAlert.isInt() && newDBAlert.asInt()<1) throw new IllegalArgumentException(BBConfiguration.DB_ALERT_THRESHOLD + " must be a positive integer value");
        if (newDBSize!=null && !newDBSize.isLong() && newDBSize.asInt()<0) throw new IllegalArgumentException(BBConfiguration.DB_SIZE_THRESHOLD + " must be a positive integer value, or 0 to disable it");
      }catch (Throwable e){
        return badRequest(e.getMessage());
      }
      if (newDBAlert!=null) BBConfiguration.setDBAlertThreshold(newDBAlert.asInt());
      if (newDBSize!=null) BBConfiguration.setDBSizeThreshold(BigInteger.valueOf(newDBSize.asLong()));
View Full Code Here

    JsonNode timeToLiveNode=bodyJson.findValue("time_to_live");
    int time_to_live = 0;

    if(!(timeToLiveNode==null)) {
      if(!(timeToLiveNode.isNumber())) throw new PushTimeToLiveFormatException("Time_to_live MUST be a positive number or equal zero");
      else if(timeToLiveNode.asInt() < 0) throw new PushTimeToLiveFormatException("Time_to_live MUST be a positive number or equal zero");
      else if(timeToLiveNode.asInt()>MAX_TIME_TO_LIVE){
        time_to_live=MAX_TIME_TO_LIVE;
      }
      else time_to_live=timeToLiveNode.asInt();
View Full Code Here

    int time_to_live = 0;

    if(!(timeToLiveNode==null)) {
      if(!(timeToLiveNode.isNumber())) throw new PushTimeToLiveFormatException("Time_to_live MUST be a positive number or equal zero");
      else if(timeToLiveNode.asInt() < 0) throw new PushTimeToLiveFormatException("Time_to_live MUST be a positive number or equal zero");
      else if(timeToLiveNode.asInt()>MAX_TIME_TO_LIVE){
        time_to_live=MAX_TIME_TO_LIVE;
      }
      else time_to_live=timeToLiveNode.asInt();

    }
View Full Code Here

      if(!(timeToLiveNode.isNumber())) throw new PushTimeToLiveFormatException("Time_to_live MUST be a positive number or equal zero");
      else if(timeToLiveNode.asInt() < 0) throw new PushTimeToLiveFormatException("Time_to_live MUST be a positive number or equal zero");
      else if(timeToLiveNode.asInt()>MAX_TIME_TO_LIVE){
        time_to_live=MAX_TIME_TO_LIVE;
      }
      else time_to_live=timeToLiveNode.asInt();

    }
    else time_to_live=MAX_TIME_TO_LIVE; //IF NULL WE SET DEFAULT VALUE (4 WEEKS)

    if (Logger.isDebugEnabled()) Logger.debug("collapse_key: " + collapse_key.toString());
View Full Code Here

TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.