Package org.codehaus.jackson

Examples of org.codehaus.jackson.JsonNode


        String type = null;
        String idAsString = null;
        while (fieldNames.hasNext())
        {
            String fieldName = fieldNames.next();
            JsonNode fieldNode = parent.get(fieldName);
            if (fieldName.equals(ID))
            {
                idAsString = fieldNode.asText();
            }
            else if (fieldName.equals(TYPE))
            {
                type = fieldNode.asText();
            }
            else if (fieldNode.isArray())
            {
                // array containing either broker children or attribute values
                Iterator<JsonNode> elements = fieldNode.getElements();
                List<Object> fieldValues = null;
                while (elements.hasNext())
                {
                    JsonNode element = elements.next();
                    if (element.isObject())
                    {
                        Class<? extends ConfiguredObject> expectedChildConfiguredObjectClass = findExpectedChildConfiguredObjectClass(
                                fieldName, expectedConfiguredObjectClass);

                        // assuming it is a child node
View Full Code Here


      (message+", at line "+token.beginLine+", column "+token.beginColumn);
  }

  private String getTextProp(String key, Map<String,JsonNode> props,
                             Token token) throws ParseException {
    JsonNode value = props.get(key);
    if (value.isTextual())
      return value.getTextValue();
    throw error(key+" property must be textual: "+value, token);
  }
View Full Code Here

    throw error(key+" property must be textual: "+value, token);
  }

  private List<String> getTextProps(String key, Map<String,JsonNode> props,
                             Token token) throws ParseException {
    JsonNode value = props.get(key);
    if (!value.isArray())
      throw error(key+" property must be array: "+value, token);
    List<String> values = new ArrayList<String>();
    for (JsonNode n : value)
      if (n.isTextual())
        values.add(n.getTextValue());
View Full Code Here

    throw new Error("Missing return statement in function");
  }

  final public void SchemaProperty(Map<String, JsonNode> properties) throws ParseException {
  String key;
  JsonNode val;
    jj_consume_token(AT);
    key = Identifier();
    jj_consume_token(LPAREN);
    val = Json();
    jj_consume_token(RPAREN);
View Full Code Here

      type.addProp(key, getTextProp(key, props, token));
  }

  final public void VariableDeclarator(Schema type, List<Field> fields) throws ParseException {
  String name;
  JsonNode defaultValue = null;
  Map<String, JsonNode> props = new LinkedHashMap<String, JsonNode>();
    label_9:
    while (true) {
      switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
      case AT:
View Full Code Here

    {if (true) return t;}
    throw new Error("Missing return statement in function");
  }

  final public JsonNode Json() throws ParseException {
  String s; Token t; JsonNode n;
    switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
    case STRING_LITERAL:
      s = JsonString();
                     n = new TextNode(s);
      break;
View Full Code Here

    }
  }

  final public void JsonPair(ObjectNode o) throws ParseException {
  String name;
  JsonNode value;
    name = JsonString();
    jj_consume_token(COLON);
    value = Json();
      o.put(name, value);
  }
View Full Code Here

      {if (true) return a;}
    throw new Error("Missing return statement in function");
  }

  final public void JsonElements(ArrayNode a) throws ParseException {
  JsonNode element;
    element = Json();
                   a.add(element);
    switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
    case COMMA:
      jj_consume_token(COMMA);
View Full Code Here

    return parseLocationFromPath(locationField, "wfs").get(0);

  }
 
  private static List<String> parseLocationFromPath(String locationField, String path) throws JsonParseException{
    JsonNode rootNode = parseLocationField(locationField);
    JsonNode pathNode = rootNode.path(path);
    Set<String> url = new HashSet<String>();
    if (pathNode.isMissingNode()){
     
      throw new JsonParseException("The Object '" + path + "' could not be found.", null);
     
    } else if (pathNode.isArray()){
     
      ArrayNode urls = (ArrayNode) rootNode.path(path);
      for(JsonNode currentUrl: urls){
        url.add(currentUrl.getTextValue());
      }
     
    } else if (pathNode.isTextual()){
      url.add(pathNode.getTextValue());
    }

    if (url == null || url.isEmpty()){
     
      throw new JsonParseException("The Object '" + path + "' is empty.", null);
View Full Code Here

    locationField.replaceAll("(?i)\"download\"", "\"fileDownload\"");
    locationField.replaceAll("(?i)\"fileDownload\"", "\"fileDownload\"");
    locationField.replaceAll("(?i)\"tilecache\"", "\"tilecache\"");

    ObjectMapper mapper = new ObjectMapper();
    JsonNode rootNode = null;
    try {
      rootNode = mapper.readTree(locationField);
    } catch (JsonProcessingException e) {
      // TODO Auto-generated catch block
      e.printStackTrace();
View Full Code Here

TOP

Related Classes of org.codehaus.jackson.JsonNode

Copyright © 2018 www.massapicom. 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.