本文整理了Java中org.codehaus.jettison.json.JSONObject.optBoolean()
方法的一些代码示例,展示了JSONObject.optBoolean()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。JSONObject.optBoolean()
方法的具体详情如下:
包路径:org.codehaus.jettison.json.JSONObject
类名称:JSONObject
方法名:optBoolean
[英]Get an optional boolean associated with a key. It returns false if there is no such key, or if the value is not Boolean.TRUE or the String "true".
[中]获取与键关联的可选布尔值。如果没有这样的键,或者该值不是布尔值,则返回false。TRUE或字符串“TRUE”。
代码示例来源:origin: org.codehaus.jettison/jettison
/**
* Get an optional boolean associated with a key.
* It returns false if there is no such key, or if the value is not
* Boolean.TRUE or the String "true".
*
* @param key A key string.
* @return The truth.
*/
public boolean optBoolean(String key) {
return optBoolean(key, false);
}
代码示例来源:origin: org.codehaus.jettison/com.springsource.org.codehaus.jettison
/**
* Get an optional boolean associated with a key.
* It returns false if there is no such key, or if the value is not
* Boolean.TRUE or the String "true".
*
* @param key A key string.
* @return The truth.
*/
public boolean optBoolean(String key) {
return optBoolean(key, false);
}
代码示例来源:origin: apache/stanbol
boolean caseSensitive = jConstraint.optBoolean("caseSensitive", false);
constraint.setProximityRanking(jConstraint.optBoolean("proximityRanking", false));
代码示例来源:origin: org.apache.apex/apex-engine
readOnlyEveryone = readOnly.optBoolean("everyone", false);
readWriteEveryone = readWrite.optBoolean("everyone", false);
代码示例来源:origin: org.glassfish.main.admin/admin-util
obj = obj.getJSONObject("command");
CachedCommandModel cm = new CachedCommandModel(obj.getString("@name"), etag);
cm.dashOk = obj.optBoolean("@unknown-options-are-operands", false);
cm.managedJob = obj.optBoolean("@managed-job", false);
cm.setUsage(obj.optString("usage", null));
Object optns = obj.opt("option");
jsOpt.getString("@name"),
typeOf(type),
jsOpt.optBoolean("@optional", false),
jsOpt.optString("@default"),
jsOpt.optString("@short"),
jsOpt.optBoolean("@obsolete", false),
jsOpt.optString("@alias"));
opt.param._acceptableValues = jsOpt.optString("@acceptable-values");
sawFile = true;
if (jsOpt.optBoolean("@primary", false)) {
opt.param._primary = true;
if (jsOpt.optBoolean("@multiple", false)) {
if (opt.type == File.class) {
opt.type = File[].class;
代码示例来源:origin: org.glassfish.main.admin/admin-util
public static AdminCommandStateImpl readAdminCommandState(JSONObject json) throws JSONException {
String strState = json.optString("state");
AdminCommandState.State state = (strState == null) ? null : AdminCommandState.State.valueOf(strState);
boolean emptyPayload = json.optBoolean("empty-payload", true);
CliActionReport ar = null;
JSONObject jsonReport = json.optJSONObject("action-report");
if (jsonReport != null) {
ar = new CliActionReport();
ActionReportJsonProprietaryReader.fillActionReport(ar, jsonReport);
}
String id = json.optString("id");
return new AdminCommandStateImpl(state, ar, emptyPayload, id);
}
代码示例来源:origin: org.apache.apex/apex-engine
/**
* A utility method that tells whether a class is considered a bean.<br/>
* For simplicity we exclude classes that have any type-args.
*
* @param className name of the class
* @return true if it is a bean false otherwise.
*/
public boolean isInstantiableBean(String className) throws JSONException
{
JSONObject classDesc = describeClass(className);
if (classDesc.has("typeArgs")) {
//any type with generics is not considered a bean
return false;
}
JSONArray classProps = classDesc.optJSONArray("properties");
if (classProps == null || classProps.length() == 0) {
//no properties then cannot be a bean
return false;
}
for (int p = 0; p < classProps.length(); p++) {
JSONObject propDesc = classProps.getJSONObject(p);
if (propDesc.optBoolean("canGet", false)) {
return true;
}
}
return false;
}
代码示例来源:origin: GluuFederation/oxAuth
result.setRequireAuthTime(requestObject.has(REQUIRE_AUTH_TIME.toString()) && requestObject.getBoolean(REQUIRE_AUTH_TIME.toString()));
result.setFrontChannelLogoutUris(frontChannelLogoutUris);
result.setFrontChannelLogoutSessionRequired(requestObject.optBoolean(FRONT_CHANNEL_LOGOUT_SESSION_REQUIRED.toString()));
result.setAccessTokenLifetime(requestObject.has(ACCESS_TOKEN_LIFETIME.toString()) ?
requestObject.getInt(ACCESS_TOKEN_LIFETIME.toString()) : null);
result.setDefaultMaxAge(requestObject.has(DEFAULT_MAX_AGE.toString()) ?
requestObject.getInt(DEFAULT_MAX_AGE.toString()) : null);
result.setRptAsJwt(requestObject.optBoolean(RPT_AS_JWT.toString()));
result.setAccessTokenAsJwt(requestObject.optBoolean(ACCESS_TOKEN_AS_JWT.toString()));
result.setAccessTokenSigningAlg(SignatureAlgorithm.fromString(requestObject.optString(ACCESS_TOKEN_SIGNING_ALG.toString())));
result.setIdTokenSignedResponseAlg(requestObject.has(ID_TOKEN_SIGNED_RESPONSE_ALG.toString()) ?
内容来源于网络,如有侵权,请联系作者删除!