本文整理了Java中org.json.JSONObject.checkName()
方法的一些代码示例,展示了JSONObject.checkName()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。JSONObject.checkName()
方法的具体详情如下:
包路径:org.json.JSONObject
类名称:JSONObject
方法名:checkName
暂无
代码示例来源:origin: robovm/robovm
/**
* Maps {@code name} to {@code value}, clobbering any existing name/value
* mapping with the same name.
*
* @return this object.
*/
public JSONObject put(String name, boolean value) throws JSONException {
nameValuePairs.put(checkName(name), value);
return this;
}
代码示例来源:origin: robovm/robovm
/**
* Maps {@code name} to {@code value}, clobbering any existing name/value
* mapping with the same name.
*
* @return this object.
*/
public JSONObject put(String name, int value) throws JSONException {
nameValuePairs.put(checkName(name), value);
return this;
}
代码示例来源:origin: robovm/robovm
/**
* Maps {@code name} to {@code value}, clobbering any existing name/value
* mapping with the same name.
*
* @return this object.
*/
public JSONObject put(String name, long value) throws JSONException {
nameValuePairs.put(checkName(name), value);
return this;
}
代码示例来源:origin: apache/geode
/**
* Maps {@code name} to {@code value}, clobbering any existing name/value mapping with the same
* name.
*
* @param name The name of the value to insert.
* @param value The value to insert.
* @return this object.
* @throws JSONException Should not be possible.
*/
public JSONObject put(String name, boolean value) throws JSONException {
nameValuePairs.put(checkName(name), value);
return this;
}
代码示例来源:origin: apache/geode
/**
* Maps {@code name} to {@code value}, clobbering any existing name/value mapping with the same
* name.
*
* @param name The name for the new value.
* @param value The new value.
* @return this object.
* @throws JSONException Should not be possible.
*/
public JSONObject put(String name, int value) throws JSONException {
nameValuePairs.put(checkName(name), value);
return this;
}
代码示例来源:origin: apache/geode
/**
* Maps {@code name} to {@code value}, clobbering any existing name/value mapping with the same
* name.
*
* @param name The name of the new value.
* @param value The new value to insert.
* @return this object.
* @throws JSONException Should not be possible.
*/
public JSONObject put(String name, long value) throws JSONException {
nameValuePairs.put(checkName(name), value);
return this;
}
代码示例来源:origin: robovm/robovm
/**
* Maps {@code name} to {@code value}, clobbering any existing name/value
* mapping with the same name.
*
* @param value a finite value. May not be {@link Double#isNaN() NaNs} or
* {@link Double#isInfinite() infinities}.
* @return this object.
*/
public JSONObject put(String name, double value) throws JSONException {
nameValuePairs.put(checkName(name), JSON.checkDouble(value));
return this;
}
代码示例来源:origin: apache/geode
/**
* Maps {@code name} to {@code value}, clobbering any existing name/value mapping with the same
* name.
*
* @param name The name for the new value.
* @param value a finite value. May not be {@link Double#isNaN() NaNs} or
* {@link Double#isInfinite() infinities}.
* @return this object.
* @throws JSONException if value is NaN or infinite.
*/
public JSONObject put(String name, double value) throws JSONException {
nameValuePairs.put(checkName(name), JSON.checkDouble(value));
return this;
}
代码示例来源:origin: robovm/robovm
/**
* Maps {@code name} to {@code value}, clobbering any existing name/value
* mapping with the same name. If the value is {@code null}, any existing
* mapping for {@code name} is removed.
*
* @param value a {@link JSONObject}, {@link JSONArray}, String, Boolean,
* Integer, Long, Double, {@link #NULL}, or {@code null}. May not be
* {@link Double#isNaN() NaNs} or {@link Double#isInfinite()
* infinities}.
* @return this object.
*/
public JSONObject put(String name, Object value) throws JSONException {
if (value == null) {
nameValuePairs.remove(name);
return this;
}
if (value instanceof Number) {
// deviate from the original by checking all Numbers, not just floats & doubles
JSON.checkDouble(((Number) value).doubleValue());
}
nameValuePairs.put(checkName(name), value);
return this;
}
代码示例来源:origin: apache/geode
/**
* Maps {@code name} to {@code value}, clobbering any existing name/value mapping with the same
* name. If the value is {@code null}, any existing mapping for {@code name} is removed.
*
* @param name The name of the new value.
* @param value a {@link JSONObject}, {@link JSONArray}, String, Boolean, Integer, Long, Double,
* {@link #NULL}, or {@code null}. May not be {@link Double#isNaN() NaNs} or
* {@link Double#isInfinite() infinities}.
* @return this object.
* @throws JSONException if the value is an invalid double (infinite or NaN).
*/
public JSONObject put(String name, Object value) throws JSONException {
if (value == null) {
nameValuePairs.remove(name);
return this;
}
if (value instanceof Number) {
// deviate from the original by checking all Numbers, not just floats & doubles
JSON.checkDouble(((Number) value).doubleValue());
}
nameValuePairs.put(checkName(name), value);
return this;
}
代码示例来源:origin: robovm/robovm
Object current = nameValuePairs.get(checkName(name));
if (current == null) {
return put(name, value);
代码示例来源:origin: apache/geode
/**
* Appends values to the array mapped to {@code name}. A new {@link JSONArray} mapping for
* {@code name} will be inserted if no mapping exists. If the existing mapping for {@code name} is
* not a {@link JSONArray}, a {@link JSONException} will be thrown.
*
* @param name The name of the array to which the value should be appended.
* @param value The value to append.
* @return this object.
* @throws JSONException if {@code name} is {@code null} or if the mapping for {@code name} is
* non-null and is not a {@link JSONArray}.
*/
public JSONObject append(String name, Object value) throws JSONException {
Object current = nameValuePairs.get(checkName(name));
final JSONArray array;
if (current instanceof JSONArray) {
array = (JSONArray) current;
} else if (current == null) {
JSONArray newArray = new JSONArray();
nameValuePairs.put(name, newArray);
array = newArray;
} else {
throw new JSONException("Key " + name + " is not a JSONArray");
}
array.checkedPut(value);
return this;
}
代码示例来源:origin: apache/geode
Object current = nameValuePairs.get(checkName(name));
if (current == null) {
return put(name, value);
代码示例来源:origin: MobiVM/robovm
/**
* Maps {@code name} to {@code value}, clobbering any existing name/value
* mapping with the same name.
*
* @return this object.
*/
public JSONObject put(String name, long value) throws JSONException {
nameValuePairs.put(checkName(name), value);
return this;
}
代码示例来源:origin: com.vaadin.external.google/android-json
/**
* Maps {@code name} to {@code value}, clobbering any existing name/value
* mapping with the same name.
*
* @return this object.
*/
public JSONObject put(String name, int value) throws JSONException {
nameValuePairs.put(checkName(name), value);
return this;
}
代码示例来源:origin: com.gluonhq/robovm-rt
/**
* Maps {@code name} to {@code value}, clobbering any existing name/value
* mapping with the same name.
*
* @return this object.
*/
public JSONObject put(String name, boolean value) throws JSONException {
nameValuePairs.put(checkName(name), value);
return this;
}
代码示例来源:origin: com.mobidevelop.robovm/robovm-rt
/**
* Maps {@code name} to {@code value}, clobbering any existing name/value
* mapping with the same name.
*
* @return this object.
*/
public JSONObject put(String name, long value) throws JSONException {
nameValuePairs.put(checkName(name), value);
return this;
}
代码示例来源:origin: MobiVM/robovm
/**
* Maps {@code name} to {@code value}, clobbering any existing name/value
* mapping with the same name.
*
* @return this object.
*/
public JSONObject put(String name, boolean value) throws JSONException {
nameValuePairs.put(checkName(name), value);
return this;
}
代码示例来源:origin: MobiVM/robovm
/**
* Maps {@code name} to {@code value}, clobbering any existing name/value
* mapping with the same name.
*
* @return this object.
*/
public JSONObject put(String name, int value) throws JSONException {
nameValuePairs.put(checkName(name), value);
return this;
}
代码示例来源:origin: MobiVM/robovm
/**
* Maps {@code name} to {@code value}, clobbering any existing name/value
* mapping with the same name.
*
* @param value a finite value. May not be {@link Double#isNaN() NaNs} or
* {@link Double#isInfinite() infinities}.
* @return this object.
*/
public JSONObject put(String name, double value) throws JSONException {
nameValuePairs.put(checkName(name), JSON.checkDouble(value));
return this;
}
内容来源于网络,如有侵权,请联系作者删除!