Package org.codehaus.jackson

Examples of org.codehaus.jackson.JsonNode.asInt()


  @Override
  Integer parse() throws ParseException {
    final JsonNode value = node.path(LEVEL_PROPERTY);
    if (value.isInt()) {
      return value.asInt();
    }
    throw new ParseException("Invalid property '" + LEVEL_PROPERTY + "': value is not an integer");
  }

}
View Full Code Here


    for (int i = 0; i < 2; i++) {
      e = it.next();
      if (!e.isInt()) {
        throw new ParseException("Invalid property '" + RANGE_PROPERTY + "': range value is not an integer");
      }
      range[i] = e.asInt();
    }

    return range;
  }
View Full Code Here

            } else if (valueNode.isObject()) {
                value = toMap(valueNode);
            } else if (valueNode.isBoolean()) {
                value = valueNode.asBoolean();
            } else if (valueNode.isInt()) {
                value = valueNode.asInt();
            } else if (valueNode.isLong()) {
                value = valueNode.asLong();
            } else if (valueNode.isDouble()) {
                value = valueNode.asDouble();
            } else {
View Full Code Here

                        categories.add(Enum.valueOf(type,jLc.getTextValue()));
                    } catch (IllegalArgumentException e) {
                        log.warn("unknown "+type.getSimpleName()+" '"+jLc+"'",e);
                    }
                } else if(jLc.isInt()) {
                        categories.add(type.getEnumConstants()[jLc.asInt()]);
                } else {
                    log.warn("unknow value in '{}' Array at index [{}]: {}",
                        new Object[]{key,i,jLc});
                }
            }
View Full Code Here

    }

    private static Integer getInteger(JsonNode node, String fieldName)
    {
        JsonNode intNode = node.get(fieldName);
        return (intNode != null) ? intNode.asInt() : null;
    }

    private static void putInteger(ObjectNode node, String fieldName, Integer value)
    {
        if ( value != null )
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.