當前位置: 首頁>>代碼示例>>Java>>正文


Java JsonObject.getBoolean方法代碼示例

本文整理匯總了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);
}
 
開發者ID:paul-io,項目名稱:momo-2,代碼行數:23,代碼來源:StrawpollObject.java

示例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);
}
 
開發者ID:ZencashOfficial,項目名稱:zencash-swing-wallet-ui,代碼行數:10,代碼來源:MessagingOptions.java

示例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; 
	}
}
 
開發者ID:ZencashOfficial,項目名稱:zencash-swing-wallet-ui,代碼行數:28,代碼來源:Message.java

示例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;
}
 
開發者ID:ZencashOfficial,項目名稱:zencash-swing-wallet-ui,代碼行數:13,代碼來源:ZCashClientCaller.java

示例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!");
		}
	}
}
 
開發者ID:ZencashOfficial,項目名稱:zencash-swing-wallet-ui,代碼行數:42,代碼來源:MessagingIdentity.java

示例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);
}
 
開發者ID:Col-E,項目名稱:Recaf,代碼行數:13,代碼來源:ConfBlocks.java


注:本文中的com.eclipsesource.json.JsonObject.getBoolean方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。