当前位置: 首页>>代码示例>>Java>>正文


Java JSONObject.getBoolean方法代码示例

本文整理汇总了Java中org.json.JSONObject.getBoolean方法的典型用法代码示例。如果您正苦于以下问题:Java JSONObject.getBoolean方法的具体用法?Java JSONObject.getBoolean怎么用?Java JSONObject.getBoolean使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在org.json.JSONObject的用法示例。


在下文中一共展示了JSONObject.getBoolean方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: parseArgs

import org.json.JSONObject; //导入方法依赖的package包/类
private void parseArgs(JSONArray args){
    Log.d(TAG,"Execute args: " + args.toString());
    if(args.length() > 0){
        try {
            final JSONObject obj = args.getJSONObject(0);
            _minTime = obj.getLong("minTime");
            _minDistance = obj.getLong("minDistance");
            _noWarn = obj.getBoolean("noWarn");
            _providers = obj.getString("providers");
            _useCache = obj.getBoolean("useCache");
            _returnSatelliteData = obj.getBoolean("satelliteData");
            _buffer = obj.getBoolean("buffer");
            _signalStrength = obj.getBoolean("signalStrength");
            _bufferSize = obj.getInt("bufferSize");

        }
        catch (Exception exc){
            Log.d(TAG, ErrorMessages.INCORRECT_CONFIG_ARGS + ", " + exc.getMessage());
            sendCallback(PluginResult.Status.ERROR, ErrorMessages.INCORRECT_CONFIG_ARGS + ", " + exc.getMessage());
        }
    }
}
 
开发者ID:SUTFutureCoder,项目名称:localcloud_fe,代码行数:23,代码来源:AdvancedGeolocation.java

示例2: verify

import org.json.JSONObject; //导入方法依赖的package包/类
private void verify(JSONObject obj) throws JSONException {
	int ret = obj.getInt("ret");
	if (ret != 0) {
		showTip("��֤ʧ��");
		return;
	}
	if ("success".equals(obj.get("rst"))) {
		if (obj.getBoolean("verf")) {
			showTip("ͨ����֤����ӭ������");
			//�ش����ݣ���½�ɹ�
			Intent intent = new Intent();
			intent.putExtra("launch_return", 1);
			setResult(RESULT_OK,intent);
			//finish();
		} else {
			showTip("��֤��ͨ��");
		}
	} else {
		showTip("��֤ʧ��");
	}
}
 
开发者ID:JosephPai,项目名称:WithYou,代码行数:22,代码来源:OnlineFace.java

示例3: buildAuthApplication

import org.json.JSONObject; //导入方法依赖的package包/类
public AuthApplication buildAuthApplication(JSONObject json) {
    String authId = json.getString("id");
    JSONObject app = json.getJSONObject("application");
    String id = app.getString("id");
    String name = app.getString("name");
    String icon = app.isNull("icon") ? null : app.getString("icon");
    String description = app.getString("description");

    boolean isPublicBot = app.has("bot_public") && app.getBoolean("bot_public");
    boolean requireCodeGrant = app.has("bot_require_code_grant") && app.getBoolean("bot_require_code_grant");

    JSONArray s = json.getJSONArray("scopes");
    List<Scope> scopes = new ArrayList<>();
    for (int i = 0; i < s.length(); i++) {
        scopes.add(Scope.getByKey(s.getString(i)));
    }

    return new AuthApplication(client, id, authId, name, icon, description, scopes, isPublicBot, requireCodeGrant);
}
 
开发者ID:AlienIdeology,项目名称:J-Cord,代码行数:20,代码来源:ObjectBuilder.java

示例4: parseQnAJSON

import org.json.JSONObject; //导入方法依赖的package包/类
public static QnA parseQnAJSON(JSONObject rootJSONObject, int no) throws JSONException {
    String title = rootJSONObject.getString("title");
    String questionContent = rootJSONObject.getString("question_content");
    String questionDate = rootJSONObject.getString("question_date");
    String writer = rootJSONObject.getString("writer");
    boolean privacy = rootJSONObject.getBoolean("privacy");

    String answerContent = null;
    String answerDate = null;
    if (rootJSONObject.getBoolean("has_answer")) {
        answerContent = rootJSONObject.getString("answer_content");
        answerDate = rootJSONObject.getString("answer_date");
    }

    return new QnA(no, title, questionContent, questionDate,
            writer, answerContent, answerDate, privacy);
}
 
开发者ID:DSM-DMS,项目名称:DMS,代码行数:18,代码来源:JSONParser.java

示例5: buildReaction

import org.json.JSONObject; //导入方法依赖的package包/类
public Reaction buildReaction(JSONObject json, Message message) {
    handleBuildError(json);
    int reactedTimes = json.has("count") ? json.getInt("count") : -1;
    boolean selfReacted = json.has("me") && json.getBoolean("me");

    Reaction reaction;
    JSONObject emojiJson = json.getJSONObject("emoji");

    /* Guild Emoji */
    if (emojiJson.has("id") && !emojiJson.isNull("id")) {
        IGuildEmoji emoji = message.getGuild().getGuildEmoji(emojiJson.getString("id"));
        if (emoji == null) { // Global Guild Emoji
            reaction = new Reaction(identity, message, reactedTimes, selfReacted, new GuildEmoji(identity, emojiJson.getString("id"), emojiJson.getString("name")));
        } else { // Guild Emoji
            reaction = new Reaction(identity, message, reactedTimes, selfReacted, emoji);
        }

    /* Emoji */
    } else {
        reaction = new Reaction(identity, message, reactedTimes, selfReacted, Emojis.getByUnicode(emojiJson.getString("name")));
    }
    return reaction;
}
 
开发者ID:AlienIdeology,项目名称:J-Cord,代码行数:24,代码来源:ObjectBuilder.java

示例6: buildIntegration

import org.json.JSONObject; //导入方法依赖的package包/类
public Integration buildIntegration(JSONObject json) {
    handleBuildError(json);

    String id = json.getString("id");
    String name = json.getString("name");
    IConnection.Type type = IConnection.Type.getByKey(json.getString("type"));
    String lastSynced = json.getString("synced_at");
    boolean enabled = json.has("enabled") && json.getBoolean("enabled");
    boolean syncing = json.has("syncing") && json.getBoolean("syncing");

    Integration integration = new Integration(identity, id, name, type, lastSynced, enabled, syncing);

    /* User */
    IUser user = identity.getUser(json.getString("user"));
    integration.setUser(user);

    /* Account */
    JSONObject acc = json.getJSONObject("account");
    integration.setAccount(new IIntegration.Account(acc.getString("id"), acc.getString("name")));

    /* Role */
    IRole role = identity.getRole(json.getString("role_id"));
    integration.setRole(role);

    return integration;
}
 
开发者ID:AlienIdeology,项目名称:J-Cord,代码行数:27,代码来源:ObjectBuilder.java

示例7: onSuccesAuth

import org.json.JSONObject; //导入方法依赖的package包/类
@Override
public void onSuccesAuth(JSONObject result) throws JSONException {

    progressDialog.hide();

    boolean getFlag = result.getBoolean("result");
    if (getFlag){
        startActivity(new Intent(this, StaffDeskActivity.class));
        overridePendingTransition(R.anim.fade_in, R.anim.fade_out);
        SharedPreferences sharedpreferences = getSharedPreferences("staff", Context.MODE_PRIVATE);
        SharedPreferences.Editor editor = sharedpreferences.edit();
        editor.putBoolean("login", true);
        editor.commit();
    }else{
        Toast.makeText(this, "Giriş Yapılamadı.", Toast.LENGTH_SHORT).show();
    }
}
 
开发者ID:yusufcakal,项目名称:RestaurantApp,代码行数:18,代码来源:StaffLoginActivity.java

示例8: parseGoingoutApplyStatusJSON

import org.json.JSONObject; //导入方法依赖的package包/类
public static Goingout parseGoingoutApplyStatusJSON(JSONObject rootJSONObject)
        throws JSONException {

    boolean sat = rootJSONObject.getBoolean("sat");
    boolean sun = rootJSONObject.getBoolean("sun");

    return new Goingout(sat, sun);
}
 
开发者ID:DSM-DMS,项目名称:DMS,代码行数:9,代码来源:JSONParser.java

示例9: testGetUsage

import org.json.JSONObject; //导入方法依赖的package包/类
public void testGetUsage() throws Exception
{
    RepoUsageStatus usageStatus = repoAdminService.getUsageStatus();
    RepoUsage usage = usageStatus.getUsage();
    LicenseDescriptor licenseDescriptor = descriptorService.getLicenseDescriptor();
    Date validUntil = (licenseDescriptor == null) ? null : licenseDescriptor.getValidUntil(); // might be null
    Integer checkLevel = new Integer(usageStatus.getLevel().ordinal());
    
    String url = "/api/admin/usage";
    TestWebScriptServer.GetRequest req = new TestWebScriptServer.GetRequest(url);
    
    Response response = sendRequest(req, Status.STATUS_OK, guest);
    System.out.println(response.getContentAsString());
    JSONObject json = new JSONObject(response.getContentAsString());
    Long users = json.isNull(AbstractAdminWebScript.JSON_KEY_USERS) ? null : json.getLong(AbstractAdminWebScript.JSON_KEY_USERS);
    assertEquals("Mismatched users", usage.getUsers(), users);
    Long documents = json.isNull(AbstractAdminWebScript.JSON_KEY_DOCUMENTS) ? null : json.getLong(AbstractAdminWebScript.JSON_KEY_DOCUMENTS);
    assertEquals("Mismatched documents", usage.getDocuments(), documents);
    String licenseMode = json.isNull(AbstractAdminWebScript.JSON_KEY_LICENSE_MODE) ? null : json.getString(AbstractAdminWebScript.JSON_KEY_LICENSE_MODE);
    assertEquals("Mismatched licenseMode", usage.getLicenseMode().toString(), licenseMode);
    boolean readOnly = json.getBoolean(AbstractAdminWebScript.JSON_KEY_READ_ONLY);
    assertEquals("Mismatched readOnly", usage.isReadOnly(), readOnly);
    boolean updated = json.getBoolean(AbstractAdminWebScript.JSON_KEY_UPDATED);
    assertEquals("Mismatched updated", false, updated);
    Long licenseValidUntil = json.isNull(AbstractAdminWebScript.JSON_KEY_LICENSE_VALID_UNTIL) ? null : json.getLong(AbstractAdminWebScript.JSON_KEY_LICENSE_VALID_UNTIL);
    assertEquals("Mismatched licenseValidUntil",
            (validUntil == null) ? null : validUntil.getTime(),
            licenseValidUntil);
    Integer level = json.isNull(AbstractAdminWebScript.JSON_KEY_LEVEL) ? null : json.getInt(AbstractAdminWebScript.JSON_KEY_LEVEL);
    assertEquals("Mismatched level", checkLevel, level);
    json.getJSONArray(AbstractAdminWebScript.JSON_KEY_WARNINGS);
    json.getJSONArray(AbstractAdminWebScript.JSON_KEY_ERRORS);
}
 
开发者ID:Alfresco,项目名称:alfresco-remote-api,代码行数:34,代码来源:AdminWebScriptTest.java

示例10: handleSuccess

import org.json.JSONObject; //导入方法依赖的package包/类
@Override
protected void handleSuccess(JSONObject jsonObject)
        throws JSONException {
    if (jsonObject.getBoolean("success")) {
        issueResponseOnMainThread(null, uploadContext.videoId);
    } else {
        handleError(new FacebookException(ERROR_BAD_SERVER_RESPONSE));
    }
}
 
开发者ID:eviltnan,项目名称:kognitivo,代码行数:10,代码来源:VideoUploader.java

示例11: RevenuePanelConfig

import org.json.JSONObject; //导入方法依赖的package包/类
public RevenuePanelConfig(JSONObject json) throws JSONException {
  try {
    showRevenuePanel = json.getBoolean(SHOW_REVENUE_PANEL);
  } catch (Exception e) {
    // ignore
  }
}
 
开发者ID:logistimo,项目名称:logistimo-web-service,代码行数:8,代码来源:DashboardConfig.java

示例12: action

import org.json.JSONObject; //导入方法依赖的package包/类
public void action(final Event<JSONObject> event) throws EventException {
	final JSONObject data = event.getData();

	logger.debug("Processing an event[type={}, data={}] in listener[className={}]", event.getType(), data,
			RhythmArticleSender.class);
	try {
		final JSONObject originalArticle = data.getJSONObject(Article.ARTICLE);

		if (!originalArticle.getBoolean(Article.ARTICLE_IS_PUBLISHED)) {
			logger.debug("Ignores post article[title={}] to Rhythm",
					originalArticle.getString(Article.ARTICLE_TITLE));

			return;
		}

		final JSONObject preference = preferenceQueryService.getPreference();

		if (null == preference) {
			throw new EventException("Not found preference");
		}

		if (!StringUtils.isBlank(originalArticle.optString(Article.ARTICLE_VIEW_PWD))) {
			return;
		}

		if (Latkes.getServePath().contains("localhost")) {
			logger.info("Solo runs on local server, so should not send this article[id={}, title={}] to Rhythm",
					originalArticle.getString(Keys.OBJECT_ID), originalArticle.getString(Article.ARTICLE_TITLE));
			return;
		}

		final HTTPRequest httpRequest = new HTTPRequest();

		httpRequest.setURL(ADD_ARTICLE_URL);
		httpRequest.setRequestMethod(RequestMethod.POST);
		final JSONObject requestJSONObject = new JSONObject();
		final JSONObject article = new JSONObject();

		article.put(Keys.OBJECT_ID, originalArticle.getString(Keys.OBJECT_ID));
		article.put(Article.ARTICLE_TITLE, originalArticle.getString(Article.ARTICLE_TITLE));
		article.put(Article.ARTICLE_PERMALINK, originalArticle.getString(Article.ARTICLE_PERMALINK));
		article.put(Article.ARTICLE_TAGS_REF, originalArticle.getString(Article.ARTICLE_TAGS_REF));
		article.put(Article.ARTICLE_AUTHOR_EMAIL, originalArticle.getString(Article.ARTICLE_AUTHOR_EMAIL));
		article.put(Article.ARTICLE_CONTENT, originalArticle.getString(Article.ARTICLE_CONTENT));
		article.put(Article.ARTICLE_CREATE_DATE,
				((Date) originalArticle.get(Article.ARTICLE_CREATE_DATE)).getTime());
		article.put(Common.POST_TO_COMMUNITY, originalArticle.getBoolean(Common.POST_TO_COMMUNITY));

		// Removes this property avoid to persist
		originalArticle.remove(Common.POST_TO_COMMUNITY);

		requestJSONObject.put(Article.ARTICLE, article);
		requestJSONObject.put(Common.BLOG_VERSION, SoloConstant.VERSION);
		requestJSONObject.put(Common.BLOG, "B3log Solo");
		requestJSONObject.put(Option.ID_C_BLOG_TITLE, preference.getString(Option.ID_C_BLOG_TITLE));
		requestJSONObject.put("blogHost", Latkes.getServePath());
		requestJSONObject.put("userB3Key", preference.optString(Option.ID_C_KEY_OF_SOLO));
		requestJSONObject.put("clientAdminEmail", preference.optString(Option.ID_C_ADMIN_EMAIL));
		requestJSONObject.put("clientRuntimeEnv", Latkes.getRuntimeEnv().name());

		httpRequest.setPayload(requestJSONObject.toString().getBytes("UTF-8"));

		urlFetchService.fetchAsync(httpRequest);
	} catch (final Exception e) {
		logger.error("Sends an article to Rhythm error: {}", e.getMessage());
	}

	logger.debug("Sent an article to Rhythm");
}
 
开发者ID:daima,项目名称:solo-spring,代码行数:70,代码来源:RhythmArticleSender.java

示例13: buildUser

import org.json.JSONObject; //导入方法依赖的package包/类
public User buildUser (JSONObject json) {
    handleBuildError(json);

    /* Basic Information */
    String id = json.has("webhook_id") ? json.getString("webhook_id") : json.getString("id");
    String name = json.getString("username");
    String discriminator = json.getString("discriminator");

    /* Require Email OAuth2 */
    String avatar = json.has("avatar") && !json.isNull("avatar") ? json.getString("avatar") : null;
    String email = json.has("email") && !json.isNull("email") ? json.getString("email") : null;

    /* Boolean Information */
    boolean isBot = json.has("bot") && json.getBoolean("bot");
    boolean isWebHook = json.has("webhook_id");
    boolean isVerified = json.has("verified") && json.getBoolean("verified");
    boolean isMFAEnabled = json.has("mfa_enabled") && json.getBoolean("mfa_enabled");

    User user = new User(identity, id)
            .setName(name)
            .setDiscriminator(discriminator)
            .setAvatar(avatar)
            .setEmail(email)
            .setBot(isBot)
            .setWebHook(isWebHook)
            .setVerified(isVerified)
            .setMFAEnabled(isMFAEnabled);

    identity.addUser(user);
    return user;
}
 
开发者ID:AlienIdeology,项目名称:J-Cord,代码行数:32,代码来源:ObjectBuilder.java

示例14: action

import org.json.JSONObject; //导入方法依赖的package包/类
public void action(final Event<JSONObject> event) throws EventException {
	final JSONObject data = event.getData();

	logger.debug("Processing an event[type={}, data={}] in listener[className={}]", event.getType(), data,
			RhythmArticleUpdater.class);
	try {
		final JSONObject originalArticle = data.getJSONObject(Article.ARTICLE);

		if (!originalArticle.getBoolean(Article.ARTICLE_IS_PUBLISHED)) {
			logger.debug("Ignores post article[title={}] to Rhythm",
					originalArticle.getString(Article.ARTICLE_TITLE));

			return;
		}

		final JSONObject preference = preferenceQueryService.getPreference();

		if (null == preference) {
			throw new EventException("Not found preference");
		}

		if (!StringUtils.isBlank(originalArticle.optString(Article.ARTICLE_VIEW_PWD))) {
			return;
		}

		if (Latkes.getServePath().contains("localhost")) {
			logger.info("Solo runs on local server, so should not send this article[id={}, title={}] to Rhythm",
					originalArticle.getString(Keys.OBJECT_ID), originalArticle.getString(Article.ARTICLE_TITLE));
			return;
		}

		final HTTPRequest httpRequest = new HTTPRequest();

		httpRequest.setURL(UPDATE_ARTICLE_URL);
		httpRequest.setRequestMethod(RequestMethod.PUT);
		final JSONObject requestJSONObject = new JSONObject();
		final JSONObject article = new JSONObject();

		article.put(Keys.OBJECT_ID, originalArticle.getString(Keys.OBJECT_ID));
		article.put(Article.ARTICLE_TITLE, originalArticle.getString(Article.ARTICLE_TITLE));
		article.put(Article.ARTICLE_PERMALINK, originalArticle.getString(Article.ARTICLE_PERMALINK));
		article.put(Article.ARTICLE_TAGS_REF, originalArticle.getString(Article.ARTICLE_TAGS_REF));
		article.put(Article.ARTICLE_AUTHOR_EMAIL, originalArticle.getString(Article.ARTICLE_AUTHOR_EMAIL));
		article.put(Article.ARTICLE_CONTENT, originalArticle.getString(Article.ARTICLE_CONTENT));
		article.put(Article.ARTICLE_CREATE_DATE,
				((Date) originalArticle.get(Article.ARTICLE_CREATE_DATE)).getTime());
		article.put(Common.POST_TO_COMMUNITY, originalArticle.getBoolean(Common.POST_TO_COMMUNITY));

		// Removes this property avoid to persist
		originalArticle.remove(Common.POST_TO_COMMUNITY);

		requestJSONObject.put(Article.ARTICLE, article);
		requestJSONObject.put(Common.BLOG_VERSION, SoloConstant.VERSION);
		requestJSONObject.put(Common.BLOG, "B3log Solo");
		requestJSONObject.put(Option.ID_C_BLOG_TITLE, preference.getString(Option.ID_C_BLOG_TITLE));
		requestJSONObject.put("blogHost", Latkes.getServerHost() + ":" + Latkes.getServerPort());
		requestJSONObject.put("userB3Key", preference.optString(Option.ID_C_KEY_OF_SOLO));
		requestJSONObject.put("clientAdminEmail", preference.optString(Option.ID_C_ADMIN_EMAIL));
		requestJSONObject.put("clientRuntimeEnv", Latkes.getRuntimeEnv().name());

		httpRequest.setPayload(requestJSONObject.toString().getBytes("UTF-8"));

		urlFetchService.fetchAsync(httpRequest);
	} catch (final Exception e) {
		logger.error("Sends an article to Rhythm error: {}", e.getMessage());
	}

	logger.debug("Sent an article to Rhythm");
}
 
开发者ID:daima,项目名称:solo-spring,代码行数:70,代码来源:RhythmArticleUpdater.java

示例15: loadGlobalReasonAssignments

import org.json.JSONObject; //导入方法依赖的package包/类
public static SortedMap<String, SortedSet<SingleWorkerAssignment<JSONArray>>> loadGlobalReasonAssignments(
        File mTurkOutputCSVFile)
        throws Exception
{
    MTurkOutputReader outputReader = new MTurkOutputReader(false, mTurkOutputCSVFile);

    // argId, set of assignments -- the json array is a list of annotated segments
    SortedMap<String, SortedSet<SingleWorkerAssignment<JSONArray>>> globalReasonAssignments = new TreeMap<>();

    for (Map<String, String> row : outputReader) {

        String workerId = row.get("workerid");
        SimpleDateFormat dateFormat = new SimpleDateFormat("EEE MMM d HH:mm:ss zzz yyyy",
                Locale.ENGLISH);
        Date time = dateFormat.parse(row.get("assignmentaccepttime"));

        // claims
        String jsonResults = row.get("Answer.collectedAnnotationResults");

        JSONObject jsonObject = new JSONObject(jsonResults);

        // iterate over argIDs
        for (Object argIdObject : jsonObject.keySet()) {
            String argId = argIdObject.toString();
            JSONObject argumentJsonAnnotations = jsonObject.getJSONObject(argId);
            JSONArray segments = argumentJsonAnnotations.getJSONArray("segments");

            // we don't need this one in fact...
            boolean noReasons = argumentJsonAnnotations.getBoolean("noReasons");

            SingleWorkerAssignment<JSONArray> singleWorkerAssignment = new SingleWorkerAssignment<>(
                    workerId, time, segments);

            // update the global map
            if (!globalReasonAssignments.containsKey(argId)) {
                globalReasonAssignments
                        .put(argId, new TreeSet<SingleWorkerAssignment<JSONArray>>());
            }
            globalReasonAssignments.get(argId).add(singleWorkerAssignment);
        }
    }
    return globalReasonAssignments;
}
 
开发者ID:UKPLab,项目名称:argument-reasoning-comprehension-task,代码行数:44,代码来源:Step2bGoldReasonAnnotator.java


注:本文中的org.json.JSONObject.getBoolean方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。