本文整理汇总了Java中com.eclipsesource.json.JsonObject.getBoolean方法的典型用法代码示例。如果您正苦于以下问题:Java JsonObject.getBoolean方法的具体用法?Java JsonObject.getBoolean怎么用?Java JsonObject.getBoolean使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类com.eclipsesource.json.JsonObject
的用法示例。
在下文中一共展示了JsonObject.getBoolean方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: fromId
import com.eclipsesource.json.JsonObject; //导入方法依赖的package包/类
/**
* Get strawpoll from its ID
* @param id ID to lookup
* @return Strawpoll Object
* @throws IOException Strawpoll.me is down or denied our API access
*/
public static StrawpollObject fromId(int id) throws IOException {
JsonValue jv = Util.jsonFromUrl(BASE_API + "/" + id);
JsonObject jo = jv.asObject();
String title = jo.getString("title", "title");
boolean multiVote = jo.getBoolean("multi", false);
JsonArray jOptions = jo.get("options").asArray();
String[] options = new String[jOptions.size()];
JsonArray jVotes = jo.get("votes").asArray();
int[] votes = new int[jVotes.size()];
for(int i = 0; i < options.length; i++) {
options[i] = jOptions.get(i).asString();
votes[i] = jVotes.get(i).asInt();
}
return new StrawpollObject(title, multiVote, options, votes);
}
示例2: copyFromJSONObject
import com.eclipsesource.json.JsonObject; //导入方法依赖的package包/类
public void copyFromJSONObject(JsonObject obj)
throws IOException
{
// Mandatory fields!
this.automaticallyAddUsersIfNotExplicitlyImported =
obj.getBoolean("automaticallyaddusersifnotexplicitlyimported", true);
this.amountToSend = obj.getDouble("amounttosend", 0.0001d);
this.transactionFee = obj.getDouble("transactionfee", 0.0001d);
}
示例3: copyFromJSONObject
import com.eclipsesource.json.JsonObject; //导入方法依赖的package包/类
public void copyFromJSONObject(JsonObject obj)
{
// Wire protocol fields
this.version = obj.getInt("ver", 1);
this.from = obj.getString("from", "");
this.message = obj.getString("message", "");
this.sign = obj.getString("sign", "");
this.threadID = obj.getString("threadid", "");
this.returnAddress = obj.getString("returnaddress", "");
// Additional fields - may be missing, get default values
this.transactionID = obj.getString("transactionID", "");
this.time = new Date(obj.getLong("time", 0));
this.direction = DIRECTION_TYPE.valueOf(
obj.getString("direction", DIRECTION_TYPE.RECEIVED.toString()));
this.verification = VERIFICATION_TYPE.valueOf(
obj.getString("verification", VERIFICATION_TYPE.UNVERIFIED.toString()));
if (obj.get("isanonymous") != null)
{
this.isAnonymous = obj.getBoolean("isanonymous", false);
} else
{
// Determine from content if it is anonymous
this.isAnonymous = obj.get("threadid") != null;
}
}
示例4: isWatchOnlyOrInvalidAddress
import com.eclipsesource.json.JsonObject; //导入方法依赖的package包/类
public synchronized boolean isWatchOnlyOrInvalidAddress(String address)
throws WalletCallException, IOException, InterruptedException
{
JsonObject response = this.executeCommandAndGetJsonValue("validateaddress", wrapStringParameter(address)).asObject();
if (response.getBoolean("isvalid", false))
{
return response.getBoolean("iswatchonly", true);
}
return true;
}
示例5: copyFromJSONObject
import com.eclipsesource.json.JsonObject; //导入方法依赖的package包/类
public void copyFromJSONObject(JsonObject obj)
throws IOException
{
// Mandatory fields!
this.nickname = obj.getString("nickname", "");
this.sendreceiveaddress = obj.getString("sendreceiveaddress", "");
this.senderidaddress = obj.getString("senderidaddress", "");
this.firstname = obj.getString("firstname", "");
this.middlename = obj.getString("middlename", "");
this.surname = obj.getString("surname", "");
this.email = obj.getString("email", "");
this.streetaddress = obj.getString("streetaddress", "");
this.facebook = obj.getString("facebook", "");
this.twitter = obj.getString("twitter", "");
this.isAnonymous = obj.getBoolean("isanonymous", false);
this.isGroup = obj.getBoolean("isgroup", false);
this.threadID = obj.getString("threadid", "");
if (this.isGroup())
{
if (Util.stringIsEmpty(this.nickname) || Util.stringIsEmpty(this.sendreceiveaddress))
{
throw new IOException("Mandatory field is missing in creating group messaging identity!");
}
} else if (this.isAnonymous())
{
if (Util.stringIsEmpty(this.nickname) || Util.stringIsEmpty(this.threadID))
{
throw new IOException("Mandatory field is missing in creating anonymous messaging identity!");
}
} else
{
// Make sure the mandatory fields are there
if (Util.stringIsEmpty(this.nickname) || Util.stringIsEmpty(this.senderidaddress))
{
throw new IOException("Mandatory field is missing in creating messaging identity!");
}
}
}
示例6: getB
import com.eclipsesource.json.JsonObject; //导入方法依赖的package包/类
/**
* Read boolean from given json object.
*
* @param object
* Object to read from.
* @param key
* Key to read.
* @return Value in object of key.
*/
private static boolean getB(JsonObject object, String key) {
return object.getBoolean(key, false);
}