当前位置: 首页>>代码示例>>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;未经允许,请勿转载。