/** * Get an optional string associated with a key. * It returns an empty string if there is no such key. If the value is not * a string and is not null, then it is coverted to a string. * * @param key A key string. * @return A string which is the value. */ public String optString(final String key) { return optString(key, ""); }
/** * Get an optional string associated with a key. * It returns an empty string if there is no such key. If the value is not * a string and is not null, then it is converted to a string. * * @param key A key string. * @return A string which is the value. */ public String optString(final String key) { return optString(key, ""); }
/** * Returns an array of SubscriptionInfo corresponding to the JSON serialization returned * by {@link TopicControl#listAllSubscriptionsAsJSON()} and related methods. */ public static SubscriptionInfo[] from(final String jsonString) throws Exception { JSONArray array = new JSONArray(jsonString); SubscriptionInfo[] infos = new SubscriptionInfo[array.length()]; for (int i = 0; i < array.length(); i++) { JSONObject sub = array.getJSONObject(i); SubscriptionInfo info = new SubscriptionInfo(sub.getString("queueName"), sub.optString("clientID", null), sub.optString("name", null), sub.getBoolean("durable"), sub.optString("selector", null), sub.getInt("messageCount"), sub.getInt("deliveringCount")); infos[i] = info; } return infos; }
/** * Returns an array of SubscriptionInfo corresponding to the JSON serialization returned * by {@link TopicControl#listAllSubscriptionsAsJSON()} and related methods. */ public static JMSConsumerInfo[] from(final String jsonString) throws Exception { JSONArray array = new JSONArray(jsonString); JMSConsumerInfo[] infos = new JMSConsumerInfo[array.length()]; for (int i = 0; i < array.length(); i++) { JSONObject sub = array.getJSONObject(i); JMSConsumerInfo info = new JMSConsumerInfo(sub.getString("consumerID"), sub.getString("connectionID"), sub.getString("destinationName"), sub.getString("destinationType"), sub.getBoolean("browseOnly"), sub.getLong("creationTime"), sub.getBoolean("durable"), sub.optString("filter", null)); infos[i] = info; } return infos; }