diff options
Diffstat (limited to 'datarouter-prov/src/main/java/org/onap/dmaap/datarouter/provisioning/utils/LOGJSONObject.java')
-rw-r--r-- | datarouter-prov/src/main/java/org/onap/dmaap/datarouter/provisioning/utils/LOGJSONObject.java | 182 |
1 files changed, 0 insertions, 182 deletions
diff --git a/datarouter-prov/src/main/java/org/onap/dmaap/datarouter/provisioning/utils/LOGJSONObject.java b/datarouter-prov/src/main/java/org/onap/dmaap/datarouter/provisioning/utils/LOGJSONObject.java index f7e08748..1140a1ce 100644 --- a/datarouter-prov/src/main/java/org/onap/dmaap/datarouter/provisioning/utils/LOGJSONObject.java +++ b/datarouter-prov/src/main/java/org/onap/dmaap/datarouter/provisioning/utils/LOGJSONObject.java @@ -186,13 +186,11 @@ public class LOGJSONObject { } } - /** * The map where the JSONObject's properties are kept. */ private final Map<String, Object> map; - /** * It is sometimes more convenient and less ambiguous to have a * <code>NULL</code> object than to use Java's <code>null</code> value. @@ -201,7 +199,6 @@ public class LOGJSONObject { */ public static final Object NULL = new Null(); - /** * Construct an empty JSONObject. */ @@ -209,7 +206,6 @@ public class LOGJSONObject { this.map = new LinkedHashMap<>(); } - /** * Construct a JSONObject from a subset of another JSONObject. * An array of strings is used to identify the keys that should be copied. @@ -229,7 +225,6 @@ public class LOGJSONObject { } } - /** * Construct a JSONObject from a JSONTokener. * @@ -287,7 +282,6 @@ public class LOGJSONObject { } } - /** * Construct a JSONObject from a Map. * @@ -309,7 +303,6 @@ public class LOGJSONObject { } } - /** * Construct a JSONObject from an Object using bean getters. * It reflects on all of the public methods of the object. @@ -334,7 +327,6 @@ public class LOGJSONObject { this.populateMap(bean); } - /** * Construct a JSONObject from an Object, using reflection to find the * public members. The resulting JSONObject's keys will be the strings @@ -359,7 +351,6 @@ public class LOGJSONObject { } } - /** * Construct a JSONObject from a source JSON text string. * This is the most commonly used JSONObject constructor. @@ -374,7 +365,6 @@ public class LOGJSONObject { this(new JSONTokener(source)); } - /** * Construct a JSONObject from a ResourceBundle. * @@ -415,7 +405,6 @@ public class LOGJSONObject { } } - /** * Accumulate values under a key. It is similar to the put method except * that if there is already an object stored under the key then a @@ -451,7 +440,6 @@ public class LOGJSONObject { return this; } - /** * Append values to the array under a key. If the key does not exist in the * JSONObject, then the key is put in the JSONObject with its value being a @@ -478,7 +466,6 @@ public class LOGJSONObject { return this; } - /** * Produce a string from a double. The string "null" will be returned if * the number is not finite. @@ -506,7 +493,6 @@ public class LOGJSONObject { return string; } - /** * Get the value object associated with a key. * @@ -526,7 +512,6 @@ public class LOGJSONObject { return object; } - /** * Get the boolean value associated with a key. * @@ -549,7 +534,6 @@ public class LOGJSONObject { "] is not a Boolean."); } - /** * Get the double value associated with a key. * @@ -570,7 +554,6 @@ public class LOGJSONObject { } } - /** * Get the int value associated with a key. * @@ -591,7 +574,6 @@ public class LOGJSONObject { } } - /** * Get the JSONArray value associated with a key. * @@ -609,7 +591,6 @@ public class LOGJSONObject { "] is not a JSONArray."); } - /** * Get the JSONObject value associated with a key. * @@ -627,7 +608,6 @@ public class LOGJSONObject { "] is not a JSONObject."); } - /** * Get the long value associated with a key. * @@ -648,7 +628,6 @@ public class LOGJSONObject { } } - /** * Get an array of field names from a JSONObject. * @@ -669,30 +648,6 @@ public class LOGJSONObject { return names; } - - /** - * Get an array of field names from an Object. - * - * @return An array of field names, or null if there are no names. - */ - public static String[] getNames(Object object) { - if (object == null) { - return null; - } - Class<? extends Object> klass = object.getClass(); - Field[] fields = klass.getFields(); - int length = fields.length; - if (length == 0) { - return null; - } - String[] names = new String[length]; - for (int i = 0; i < length; i += 1) { - names[i] = fields[i].getName(); - } - return names; - } - - /** * Get the string associated with a key. * @@ -709,7 +664,6 @@ public class LOGJSONObject { "] not a string."); } - /** * Determine if the JSONObject contains a specific key. * @@ -720,7 +674,6 @@ public class LOGJSONObject { return this.map.containsKey(key); } - /** * Increment a property of a JSONObject. If there is no such property, * create one with a value of 1. If there is such a property, and if @@ -749,20 +702,6 @@ public class LOGJSONObject { return this; } - - /** - * Determine if the value associated with the key is null or if there is - * no value. - * - * @param key A key string. - * @return true if there is no value associated with the key or if - * the value is the JSONObject.NULL object. - */ - public boolean isNull(String key) { - return LOGJSONObject.NULL.equals(this.opt(key)); - } - - /** * Get an enumeration of the keys of the JSONObject. * @@ -772,7 +711,6 @@ public class LOGJSONObject { return this.keySet().iterator(); } - /** * Get a set of keys of the JSONObject. * @@ -782,7 +720,6 @@ public class LOGJSONObject { return this.map.keySet(); } - /** * Get the number of keys stored in the JSONObject. * @@ -792,7 +729,6 @@ public class LOGJSONObject { return this.map.size(); } - /** * Produce a JSONArray containing the names of the elements of this * JSONObject. @@ -838,7 +774,6 @@ public class LOGJSONObject { return string; } - /** * Get an optional value associated with a key. * @@ -849,20 +784,6 @@ public class LOGJSONObject { return key == null ? null : this.map.get(key); } - - /** - * Get an optional boolean associated with a key. - * It returns false if there is no such key, or if the value is not - * Boolean.TRUE or the String "true". - * - * @param key A key string. - * @return The truth. - */ - public boolean optBoolean(String key) { - return this.optBoolean(key, false); - } - - /** * Get an optional boolean associated with a key. * It returns the defaultValue if there is no such key, or if it is not @@ -881,21 +802,6 @@ public class LOGJSONObject { } } - - /** - * Get an optional double associated with a key, - * or NaN if there is no such key or if its value is not a number. - * If the value is a string, an attempt will be made to evaluate it as - * a number. - * - * @param key A string which is the key. - * @return An object which is the value. - */ - public double optDouble(String key) { - return this.optDouble(key, Double.NaN); - } - - /** * Get an optional double associated with a key, or the * defaultValue if there is no such key or if its value is not a number. @@ -915,21 +821,6 @@ public class LOGJSONObject { } } - - /** - * Get an optional int value associated with a key, - * or zero if there is no such key or if the value is not a number. - * If the value is a string, an attempt will be made to evaluate it as - * a number. - * - * @param key A key string. - * @return An object which is the value. - */ - public int optInt(String key) { - return this.optInt(key, 0); - } - - /** * Get an optional int value associated with a key, * or the default if there is no such key or if the value is not a number. @@ -949,21 +840,6 @@ public class LOGJSONObject { } } - - /** - * Get an optional JSONArray associated with a key. - * It returns null if there is no such key, or if its value is not a - * JSONArray. - * - * @param key A key string. - * @return A JSONArray which is the value. - */ - public JSONArray optJSONArray(String key) { - Object o = this.opt(key); - return o instanceof JSONArray ? (JSONArray) o : null; - } - - /** * Get an optional JSONObject associated with a key. * It returns null if there is no such key, or if its value is not a @@ -977,21 +853,6 @@ public class LOGJSONObject { return object instanceof LOGJSONObject ? (LOGJSONObject) object : null; } - - /** - * Get an optional long value associated with a key, - * or zero if there is no such key or if the value is not a number. - * If the value is a string, an attempt will be made to evaluate it as - * a number. - * - * @param key A key string. - * @return An object which is the value. - */ - public long optLong(String key) { - return this.optLong(key, 0); - } - - /** * Get an optional long value associated with a key, * or the default if there is no such key or if the value is not a number. @@ -1010,20 +871,6 @@ public class LOGJSONObject { } } - - /** - * 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(String key) { - return this.optString(key, ""); - } - - /** * Get an optional string associated with a key. * It returns the defaultValue if there is no such key. @@ -1037,7 +884,6 @@ public class LOGJSONObject { return NULL.equals(object) ? defaultValue : object.toString(); } - private void populateMap(Object bean) { Class<? extends Object> klass = bean.getClass(); @@ -1086,7 +932,6 @@ public class LOGJSONObject { } } - /** * Put a key/boolean pair in the JSONObject. * @@ -1100,7 +945,6 @@ public class LOGJSONObject { return this; } - /** * Put a key/value pair in the JSONObject, where the value will be a * JSONArray which is produced from a Collection. @@ -1115,7 +959,6 @@ public class LOGJSONObject { return this; } - /** * Put a key/double pair in the JSONObject. * @@ -1129,7 +972,6 @@ public class LOGJSONObject { return this; } - /** * Put a key/int pair in the JSONObject. * @@ -1143,7 +985,6 @@ public class LOGJSONObject { return this; } - /** * Put a key/long pair in the JSONObject. * @@ -1157,7 +998,6 @@ public class LOGJSONObject { return this; } - /** * Put a key/value pair in the JSONObject, where the value will be a * JSONObject which is produced from a Map. @@ -1172,7 +1012,6 @@ public class LOGJSONObject { return this; } - /** * Put a key/value pair in the JSONObject. If the value is null, * then the key will be removed from the JSONObject if it is present. @@ -1208,7 +1047,6 @@ public class LOGJSONObject { return this; } - /** * Put a key/value pair in the JSONObject, but only if the key and the * value are both non-null, and only if there is not already a member @@ -1229,7 +1067,6 @@ public class LOGJSONObject { return this; } - /** * Put a key/value pair in the JSONObject, but only if the * key and the value are both non-null. @@ -1248,7 +1085,6 @@ public class LOGJSONObject { return this; } - /** * Produce a string in double quotes with backslash sequences in all the * right places. A backslash will be inserted within </, producing <\/, @@ -1394,7 +1230,6 @@ public class LOGJSONObject { return string; } - /** * Throw an exception if the object is a NaN or infinite number. * @@ -1417,7 +1252,6 @@ public class LOGJSONObject { } } - /** * Produce a JSONArray containing the values of the members of this * JSONObject. @@ -1459,7 +1293,6 @@ public class LOGJSONObject { } } - /** * Make a prettyprinted JSON text of this JSONObject. * <p> @@ -1593,21 +1426,6 @@ public class LOGJSONObject { } } - - /** - * Write the contents of the JSONObject as JSON text to a writer. - * For compactness, no whitespace is added. - * <p> - * Warning: This method assumes that the data structure is acyclical. - * - * @return The writer. - * @throws JSONException - */ - public Writer write(Writer writer) throws JSONException { - return this.write(writer, 0, 0); - } - - @SuppressWarnings("unchecked") static final Writer writeValue(Writer writer, Object value, int indentFactor, int indent) throws JSONException, IOException { |