Package org.json.simple

Examples of org.json.simple.JSONObject.keySet()


            JSONObject obj = parseJSONObject(mk.getNodes("/", rev2, 0, 0, 10, null));
            // make changes from second MongoMK visible
            mk2.runBackgroundOperations();
            mk.runBackgroundOperations();
            // check child nodes of previous getNodes() call
            for (Object key : obj.keySet()) {
                String name = key.toString();
                if (name.startsWith(":")) {
                    continue;
                }
                assertNodesExist(rev2, "/" + name);
View Full Code Here


            assertEquals(3L, obj.get(":childNodeCount"));
            // @rev3 is after background read
            rev3 = mk.getHeadRevision();
            // now all nodes must be visible
            obj = parseJSONObject(mk.getNodes("/", rev3, 0, 0, 10, null));
            for (Object key : obj.keySet()) {
                String name = key.toString();
                if (name.startsWith(":")) {
                    continue;
                }
                assertNodesExist(rev3, "/" + name);
View Full Code Here

        {
            JSONObject flags = (JSONObject) JSONValue.parse(flagString);

            if (flags != null)
            {
                for (Object flag : flags.keySet())
                {
                    // reading the list of flags from json

                    try
                    {
View Full Code Here

            Object obj = JSONValue.parse(flagString);
            JSONObject flags = (JSONObject) obj;

            if (flags != null)
            {
                for (Object flag : flags.keySet())
                {
                    try
                    {
                        if (flag.equals("rank"))
                        {
View Full Code Here

       
        JSONObject counters = (JSONObject) result.get("counters");

        writer.print("<table><tr><td>Number of counters:</td><td>" + counters.size() + "</td></tr></table>");
       
        List<String> sortedKeys = new ArrayList<String>(counters.keySet());
        Collections.sort(sortedKeys);
       
        for (Object counterKey : sortedKeys) {
          String counterName = (String) counterKey;
          JSONObject json = (JSONObject) counters.get(counterName);
View Full Code Here

          JSONObject json = (JSONObject) counters.get(counterName);
         
          if (!json.isEmpty()) {
            writer.print("<table><thead><th colspan=\"3\">" + counterName + "</th></thead><tbody>");
           
            for (Object key : json.keySet()) {
              writer.print("<tr><td>");
              writer.print(key);
              writer.print("</td><td style=\"border-left: 1px solid grey; border-right: 1px solid grey;\">");
              writer.print(new Date((Long) key * 1000).toString()); //modify the dates back to include milliseconds
              writer.print("</td><td>");
View Full Code Here

          if(type == String.class) {
            inputField.set(formValue, jsonInputs.get(inputName));
          } else if (type.isAssignableFrom(Map.class)) {
            Map<String, String> map = new HashMap<String, String>();
            JSONObject jsonObject = (JSONObject) jsonInputs.get(inputName);
            for(Object key : jsonObject.keySet()) {
              map.put((String)key, (String)jsonObject.get(key));
            }
            inputField.set(formValue, map);
          } else if(type == Integer.class) {
            inputField.set(formValue, ((Long)jsonInputs.get(inputName)).intValue());
View Full Code Here

  public static void fillValues(String json, Object configuration) {
    Class klass = configuration.getClass();

    JSONObject jsonObject = (JSONObject) JSONValue.parse(json);

    for(Object k : jsonObject.keySet()) {
      String key = (String)k;

      Field field;
      try {
        field = klass.getDeclaredField(key);
View Full Code Here

      try {
        if(type == String.class) {
          field.set(configuration, jsonObject.get(key));
        } else if (type.isAssignableFrom(Map.class)) {
          Map<String, String> map = new HashMap<String, String>();
          for(Object kk : jsonObject.keySet()) {
            map.put((String)kk, (String)jsonObject.get(kk));
          }
          field.set(key, map);
        } else if(type == Integer.class) {
          field.set(configuration, jsonObject.get(key));
View Full Code Here

  public Validation restoreValidation(JSONObject jsonObject) {
    JSONObject jsonMessages = (JSONObject) jsonObject.get(MESSAGES);
    Map<Validation.FormInput, Validation.Message> messages
      = new HashMap<Validation.FormInput, Validation.Message>();

    for(Object key : jsonMessages.keySet()) {
      JSONObject jsonMessage = (JSONObject) jsonMessages.get(key);

      Status status = Status.valueOf((String) jsonMessage.get(STATUS));
      String stringMessage = (String) jsonMessage.get(MESSAGE);
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.