com.eclipsesource.json.JsonObject.set()方法的使用及代码示例

x33g5p2x  于2022-01-21 转载在 其他  
字(8.9k)|赞(0)|评价(0)|浏览(101)

本文整理了Java中com.eclipsesource.json.JsonObject.set()方法的一些代码示例,展示了JsonObject.set()的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。JsonObject.set()方法的具体详情如下:
包路径:com.eclipsesource.json.JsonObject
类名称:JsonObject
方法名:set

JsonObject.set介绍

[英]Sets the value of the member with the specified name to the JSON representation of the specified double value. If this object does not contain a member with this name, a new member is added at the end of the object. If this object contains multiple members with this name, only the last one is changed.

This method should only be used to modify existing objects. To fill a new object with members, the method add(name, value) should be preferred which is much faster (as it does not need to search for existing members).
[中]

代码示例

代码示例来源:origin: ralfstx/minimal-json

/**
 * Copies all members of the specified object into this object. When the specified object contains
 * members with names that also exist in this object, the existing values in this object will be
 * replaced by the corresponding values in the specified object.
 *
 * @param object
 *          the object to merge
 * @return the object itself, to enable method chaining
 */
public JsonObject merge(JsonObject object) {
 if (object == null) {
  throw new NullPointerException("object is null");
 }
 for (Member member : object) {
  this.set(member.name, member.value);
 }
 return this;
}

代码示例来源:origin: ralfstx/minimal-json

/**
 * Sets the value of the member with the specified name to the JSON representation of the
 * specified <code>float</code> value. If this object does not contain a member with this name, a
 * new member is added at the end of the object. If this object contains multiple members with
 * this name, only the last one is changed.
 * <p>
 * This method should <strong>only be used to modify existing objects</strong>. To fill a new
 * object with members, the method <code>add(name, value)</code> should be preferred which is much
 * faster (as it does not need to search for existing members).
 * </p>
 *
 * @param name
 *          the name of the member to add
 * @param value
 *          the value of the member to add
 * @return the object itself, to enable method chaining
 */
public JsonObject set(String name, float value) {
 set(name, Json.value(value));
 return this;
}

代码示例来源:origin: ralfstx/minimal-json

/**
 * Sets the value of the member with the specified name to the JSON representation of the
 * specified <code>long</code> value. If this object does not contain a member with this name, a
 * new member is added at the end of the object. If this object contains multiple members with
 * this name, only the last one is changed.
 * <p>
 * This method should <strong>only be used to modify existing objects</strong>. To fill a new
 * object with members, the method <code>add(name, value)</code> should be preferred which is much
 * faster (as it does not need to search for existing members).
 * </p>
 *
 * @param name
 *          the name of the member to replace
 * @param value
 *          the value to set to the member
 * @return the object itself, to enable method chaining
 */
public JsonObject set(String name, long value) {
 set(name, Json.value(value));
 return this;
}

代码示例来源:origin: ralfstx/minimal-json

/**
 * Sets the value of the member with the specified name to the JSON representation of the
 * specified <code>boolean</code> value. If this object does not contain a member with this name,
 * a new member is added at the end of the object. If this object contains multiple members with
 * this name, only the last one is changed.
 * <p>
 * This method should <strong>only be used to modify existing objects</strong>. To fill a new
 * object with members, the method <code>add(name, value)</code> should be preferred which is much
 * faster (as it does not need to search for existing members).
 * </p>
 *
 * @param name
 *          the name of the member to add
 * @param value
 *          the value of the member to add
 * @return the object itself, to enable method chaining
 */
public JsonObject set(String name, boolean value) {
 set(name, Json.value(value));
 return this;
}

代码示例来源:origin: ralfstx/minimal-json

/**
 * Sets the value of the member with the specified name to the JSON representation of the
 * specified string. If this object does not contain a member with this name, a new member is
 * added at the end of the object. If this object contains multiple members with this name, only
 * the last one is changed.
 * <p>
 * This method should <strong>only be used to modify existing objects</strong>. To fill a new
 * object with members, the method <code>add(name, value)</code> should be preferred which is much
 * faster (as it does not need to search for existing members).
 * </p>
 *
 * @param name
 *          the name of the member to add
 * @param value
 *          the value of the member to add
 * @return the object itself, to enable method chaining
 */
public JsonObject set(String name, String value) {
 set(name, Json.value(value));
 return this;
}

代码示例来源:origin: ralfstx/minimal-json

/**
 * Sets the value of the member with the specified name to the JSON representation of the
 * specified <code>int</code> value. If this object does not contain a member with this name, a
 * new member is added at the end of the object. If this object contains multiple members with
 * this name, only the last one is changed.
 * <p>
 * This method should <strong>only be used to modify existing objects</strong>. To fill a new
 * object with members, the method <code>add(name, value)</code> should be preferred which is much
 * faster (as it does not need to search for existing members).
 * </p>
 *
 * @param name
 *          the name of the member to replace
 * @param value
 *          the value to set to the member
 * @return the object itself, to enable method chaining
 */
public JsonObject set(String name, int value) {
 set(name, Json.value(value));
 return this;
}

代码示例来源:origin: ralfstx/minimal-json

/**
 * Sets the value of the member with the specified name to the JSON representation of the
 * specified <code>double</code> value. If this object does not contain a member with this name, a
 * new member is added at the end of the object. If this object contains multiple members with
 * this name, only the last one is changed.
 * <p>
 * This method should <strong>only be used to modify existing objects</strong>. To fill a new
 * object with members, the method <code>add(name, value)</code> should be preferred which is much
 * faster (as it does not need to search for existing members).
 * </p>
 *
 * @param name
 *          the name of the member to add
 * @param value
 *          the value of the member to add
 * @return the object itself, to enable method chaining
 */
public JsonObject set(String name, double value) {
 set(name, Json.value(value));
 return this;
}

代码示例来源:origin: BTCPrivate/bitcoin-private-full-node-wallet

public JsonObject toJSONObject()
{
  JsonObject obj = new JsonObject();
  obj.set("automaticallyaddusersifnotexplicitlyimported",
      this.automaticallyAddUsersIfNotExplicitlyImported);
  obj.set("amounttosend",	this.amountToSend);
  obj.set("transactionfee",	this.transactionFee);
  return obj;
}

代码示例来源:origin: ZencashOfficial/zencash-swing-wallet-ui

public JsonObject toJSONObject()
{
  JsonObject obj = new JsonObject();
  
  obj.set("automaticallyaddusersifnotexplicitlyimported",
      this.automaticallyAddUsersIfNotExplicitlyImported);
  obj.set("amounttosend",	this.amountToSend);
  obj.set("transactionfee",	this.transactionFee);
  
  return obj;
}

代码示例来源:origin: box/box-android-sdk

public void set(final String field, final JsonArray value){
  mJsonObject.set(field, value);
  if (mInternalCache.containsKey(field)) {
    mInternalCache.remove(field);
  }
}

代码示例来源:origin: box/box-android-sdk

public void set(final String field, final Long value){
  mJsonObject.set(field, value);
  if (mInternalCache.containsKey(field)) {
    mInternalCache.remove(field);
  }
}

代码示例来源:origin: box/box-android-sdk

public void set(final String field, final Integer value){
  mJsonObject.set(field, value);
  if (mInternalCache.containsKey(field)) {
    mInternalCache.remove(field);
  }
}

代码示例来源:origin: box/box-android-sdk

public void set(final String field, final String value){
  mJsonObject.set(field, value);
  if (mInternalCache.containsKey(field)) {
    mInternalCache.remove(field);
  }
}

代码示例来源:origin: box/box-android-sdk

public void set(final String field, final boolean value){
  mJsonObject.set(field, value);
  if (mInternalCache.containsKey(field)) {
    mInternalCache.remove(field);
  }
}

代码示例来源:origin: box/box-android-sdk

public void set(final String field, final Double value){
  mJsonObject.set(field, value);
  if (mInternalCache.containsKey(field)) {
    mInternalCache.remove(field);
  }
}

代码示例来源:origin: box/box-android-sdk

public void set(final String field, final Float value){
  mJsonObject.set(field, value);
  if (mInternalCache.containsKey(field)) {
    mInternalCache.remove(field);
  }
}

代码示例来源:origin: box/box-android-sdk

public void set(final String field, final JsonObject value) {
  mJsonObject.set(field, value);
  if (mInternalCache.containsKey(field)) {
    mInternalCache.remove(field);
  }
}

代码示例来源:origin: box/box-android-sdk

public void set(final String field, final BoxJsonObject value) {
  mJsonObject.set(field, value.toJsonObject());
  if (mInternalCache.containsKey(field)) {
    mInternalCache.remove(field);
  }
}

代码示例来源:origin: box/box-java-sdk

/**
 * Replaces an existing metadata value.
 * @param path the path that designates the key. Must be prefixed with a "/".
 * @param value the value.
 * @return this metadata object.
 */
public Metadata replace(String path, float value) {
  this.values.set(this.pathToProperty(path), value);
  this.addOp("replace", path, value);
  return this;
}

代码示例来源:origin: box/box-java-sdk

/**
 * Replaces an existing metadata value.
 * @param path the path that designates the key. Must be prefixed with a "/".
 * @param value the value.
 * @return this metadata object.
 */
public Metadata replace(String path, String value) {
  this.values.set(this.pathToProperty(path), value);
  this.addOp("replace", path, value);
  return this;
}

相关文章