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


Java JSONObject.getBoolean方法代碼示例

本文整理匯總了Java中com.alibaba.fastjson.JSONObject.getBoolean方法的典型用法代碼示例。如果您正苦於以下問題:Java JSONObject.getBoolean方法的具體用法?Java JSONObject.getBoolean怎麽用?Java JSONObject.getBoolean使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在com.alibaba.fastjson.JSONObject的用法示例。


在下文中一共展示了JSONObject.getBoolean方法的10個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。

示例1: FromJsonString

import com.alibaba.fastjson.JSONObject; //導入方法依賴的package包/類
public static AschResult FromJsonString(String jsonString){
    AschResult result = new AschResult();

    result.rawJson = jsonString;
    result.jsonObject = JSONObject.parseObject(jsonString);

    JSONObject json = result.jsonObject;
    if (json.containsKey("success")){
        result.successful = json.getBoolean("success");
    }

    if (json.containsKey("error")){
        result.error = json.getString("error");
    }

    return result;
}
 
開發者ID:AschPlatform,項目名稱:asch-java,代碼行數:18,代碼來源:AschResult.java

示例2: fieldsFixedPartIsCorrect

import com.alibaba.fastjson.JSONObject; //導入方法依賴的package包/類
/**
 * fieldsFixedPartIsCorrect
 * Check the fixed parts _ums_id_, _ums_ts_, _ums_op_ are correct
 * @param fields
 * @return
 */
private boolean fieldsFixedPartIsCorrect(JSONArray fields) {
    JSONObject jo1 = fields.getJSONObject(0);
    if (!jo1.getString("name").equals("_ums_id_") || !jo1.getString("type").equals("long")
            || jo1.getBoolean("nullable")) {
        return false;
    }
    JSONObject jo2 = fields.getJSONObject(1);
    if (!jo2.getString("name").equals("_ums_ts_") || !jo2.getString("type").equals("datetime")
            || jo2.getBoolean("nullable")) return false;

    JSONObject jo3 = fields.getJSONObject(2);
    if (!jo3.getString("name").equals("_ums_op_") || !jo3.getString("type").equals("string")
            || jo3.getBoolean("nullable")) return false;

    return true;
}
 
開發者ID:BriData,項目名稱:DBus,代碼行數:23,代碼來源:FullPullerPerfChecker.java

示例3: permission

import com.alibaba.fastjson.JSONObject; //導入方法依賴的package包/類
@Override
public int permission(JSONArray datas, int id) {
    for (int i = 0; i < datas.size(); i ++) {
        JSONObject json = datas.getJSONObject(i);
        if (json.getBoolean("checked")) {
            // 新增權限
            UpmsUserPermission upmsUserPermission = new UpmsUserPermission();
            upmsUserPermission.setUserId(id);
            upmsUserPermission.setPermissionId(json.getIntValue("id"));
            upmsUserPermission.setType(json.getByte("type"));
            upmsUserPermissionMapper.insertSelective(upmsUserPermission);
        } else {
            // 刪除權限
            UpmsUserPermissionExample upmsUserPermissionExample = new UpmsUserPermissionExample();
            upmsUserPermissionExample.createCriteria()
                    .andPermissionIdEqualTo(json.getIntValue("id"))
                    .andTypeEqualTo(json.getByte("type"));
            upmsUserPermissionMapper.deleteByExample(upmsUserPermissionExample);
        }
    }
    return datas.size();
}
 
開發者ID:youngMen1,項目名稱:-Spring-SpringMVC-Mybatis-,代碼行數:23,代碼來源:UpmsUserPermissionServiceImpl.java

示例4: rolePermission

import com.alibaba.fastjson.JSONObject; //導入方法依賴的package包/類
@Override
public int rolePermission(JSONArray datas, int id) {
    List<Integer> deleteIds = new ArrayList<>();
    for (int i = 0; i < datas.size(); i ++) {
        JSONObject json = datas.getJSONObject(i);
        if (!json.getBoolean("checked")) {
            deleteIds.add(json.getIntValue("id"));
        } else {
            // 新增權限
            UpmsRolePermission upmsRolePermission = new UpmsRolePermission();
            upmsRolePermission.setRoleId(id);
            upmsRolePermission.setPermissionId(json.getIntValue("id"));
            upmsRolePermissionMapper.insertSelective(upmsRolePermission);
        }
    }
    // 刪除權限
    if (deleteIds.size() > 0) {
        UpmsRolePermissionExample upmsRolePermissionExample = new UpmsRolePermissionExample();
        upmsRolePermissionExample.createCriteria()
                .andPermissionIdIn(deleteIds)
                .andRoleIdEqualTo(id);
        upmsRolePermissionMapper.deleteByExample(upmsRolePermissionExample);
    }
    return datas.size();
}
 
開發者ID:youngMen1,項目名稱:-Spring-SpringMVC-Mybatis-,代碼行數:26,代碼來源:UpmsRolePermissionServiceImpl.java

示例5: init

import com.alibaba.fastjson.JSONObject; //導入方法依賴的package包/類
private void init(JSONObject json) throws WeiboException {
	if(json!=null){
		try {
			id = json.getString("id");
			screenName = json.getString("screen_name");
			name = json.getString("name");
			province = json.getInteger("province");
			city = json.getInteger("city");
			location = json.getString("location");
			description = json.getString("description");
			url = json.getString("url");
			profileImageUrl = json.getString("profile_image_url");
			userDomain = json.getString("domain");
			gender = json.getString("gender");
			followersCount = json.getInteger("followers_count");
			friendsCount = json.getInteger("friends_count");
			favouritesCount = json.getInteger("favourites_count");
			statusesCount = json.getInteger("statuses_count");
			verifiedType = json.getInteger("verified_type"); 
			verifiedReason = json.getString("verified_reason");
			allowAllActMsg = json.getBoolean("allow_all_act_msg");
			allowAllComment = json.getBoolean("allow_all_comment");
			followMe = json.getBoolean("follow_me");
			avatarLarge = json.getString("avatar_large");
			onlineStatus = json.getInteger("online_status");
			statusId = json.getString("status_id");
			biFollowersCount = json.getInteger("bi_followers_count");
			if(!json.getString("remark").isEmpty()){					
				remark = json.getString("remark");
			}
			lang = json.getString("lang");
			weihao = json.getString("weihao");
		} catch (JSONException jsone) {
			throw new WeiboException(jsone.getMessage() + ":" + json.toString(), jsone);
		}
	}
}
 
開發者ID:liaojiacan,項目名稱:zhkuas_ssm_maven,代碼行數:38,代碼來源:User.java

示例6: convert

import com.alibaba.fastjson.JSONObject; //導入方法依賴的package包/類
@Override
public ArrayList<MultipleItemEntity> convert() {


    final JSONArray array = JSON.parseObject(getJsonData()).getJSONArray("data");
    final int size = array.size();
    for (int i = 0; i < size; i++) {

        final JSONObject data = array.getJSONObject(i);
        final int id = data.getInteger("id");
        final String name = data.getString("name");
        final String phone = data.getString("phone");
        final String address = data.getString("address");
        final boolean isDefault = data.getBoolean("default");

        final MultipleItemEntity entity = MultipleItemEntity.builder()
                .setItemType(AddressItemType.ITEM_ADDRESS)
                .setField(MultipleFields.ID, id)
                .setField(MultipleFields.NAME, name)
                .setField(MultipleFields.TAG, isDefault)
                .setField(AddressItemFields.PHONE, phone)
                .setField(AddressItemFields.ADDRESS, address)
                .build();

        ENTITIES.add(entity);

    }

    return ENTITIES;
}
 
開發者ID:remerber,項目名稱:FastEc,代碼行數:31,代碼來源:AddressDataConverter.java

示例7: parseData

import com.alibaba.fastjson.JSONObject; //導入方法依賴的package包/類
@Override
protected void parseData(JSONObject data) {
    sendAccount = data.getString(KEY_SEND);
    openAccount = data.getString(KEY_OPEN);
    redPacketId = data.getString(KEY_RP_ID);
    isGetDone = data.getBoolean(KEY_DONE);
}
 
開發者ID:newDeepLearing,項目名稱:decoy,代碼行數:8,代碼來源:RedPacketOpenedAttachment.java

示例8: getConfig

import com.alibaba.fastjson.JSONObject; //導入方法依賴的package包/類
private static StatusBarNotificationConfig getConfig(String key) {
    StatusBarNotificationConfig config = new StatusBarNotificationConfig();
    String jsonString = getSharedPreferences().getString(key, "");
    try {
        JSONObject jsonObject = JSONObject.parseObject(jsonString);
        if (jsonObject == null) {
            return null;
        }
        config.downTimeBegin = jsonObject.getString("downTimeBegin");
        config.downTimeEnd = jsonObject.getString("downTimeEnd");
        config.downTimeToggle = jsonObject.getBoolean("downTimeToggle");
        config.ring = jsonObject.getBoolean("ring");
        config.vibrate = jsonObject.getBoolean("vibrate");
        config.notificationSmallIconId = jsonObject.getIntValue("notificationSmallIconId");
        config.notificationSound = jsonObject.getString("notificationSound");
        config.hideContent = jsonObject.getBoolean("hideContent");
        config.ledARGB = jsonObject.getIntValue("ledargb");
        config.ledOnMs = jsonObject.getIntValue("ledonms");
        config.ledOffMs = jsonObject.getIntValue("ledoffms");
        config.titleOnlyShowAppName = jsonObject.getBoolean("titleOnlyShowAppName");
        config.notificationFolded = jsonObject.getBoolean("notificationFolded");
        config.notificationEntrance = (Class<? extends Activity>) Class.forName(jsonObject.getString("notificationEntrance"));
        config.notificationColor = jsonObject.getInteger("notificationColor");
    } catch (Exception e) {
        e.printStackTrace();
    }

    return config;
}
 
開發者ID:newDeepLearing,項目名稱:decoy,代碼行數:30,代碼來源:UserPreferences.java

示例9: push

import com.alibaba.fastjson.JSONObject; //導入方法依賴的package包/類
@JSMethod
public void push(String encodeParam, JSCallback callback) {
    if (TextUtils.isEmpty(encodeParam)) {
        return;
    }
    try {
        JSONObject options = JSON.parseObject(encodeParam);
        String url = "";
        UWXTheme.NavBar navBar = null;
        JSONObject param = null;
        boolean animated = false;
        if (options.containsKey(UWXBundleInfo.KEY_URL)) {
            url = options.getString(UWXBundleInfo.KEY_URL);
        }
        if (options.containsKey(UWXBundleInfo.KEY_NAV_BAR)) {
            String _navBar = options.getString(UWXBundleInfo.KEY_NAV_BAR);
            if (!TextUtils.isEmpty(_navBar)) {
                navBar = JSON.parseObject(_navBar, UWXTheme.NavBar.class);
            }
        }
        if (options.containsKey(UWXBundleInfo.KEY_PARAM)) {
            param = options.getJSONObject(UWXBundleInfo.KEY_PARAM);
        }

        if (options.containsKey(UWXBundleInfo.KEY_SCENE_CONFIGS)) {
            animated = options.getBoolean(UWXBundleInfo.KEY_SCENE_CONFIGS);
        }
        UWLog.v("params=" + encodeParam);
        UWXTheme theme = null;
        if (navBar == null) {
            theme = UWXThemeManager.getInstance().getPageTheme();
        } else {
            UWXThemeManager.getInstance().getPageTheme().setNavBar(navBar);
            theme = UWXThemeManager.getInstance().getPageTheme();
        }
        if (!TextUtils.isEmpty(url)) {

            UWXJumpUtil.openPageByUrl((Activity) mWXSDKInstance.getContext(), url, param, theme);
            if (callback != null) {
                callback.invoke(MSG_SUCCESS);
            }
        } else {
            callback.invoke(MSG_FAILED);
        }
    } catch (Exception e) {
        WXLogUtils.eTag(TAG, e);
        if (callback != null) {
            callback.invoke(MSG_FAILED);
        }
    }
}
 
開發者ID:weexext,項目名稱:ucar-weex-core,代碼行數:52,代碼來源:UWXNavigatorModule.java

示例10: getBooleanFromDataByKey

import com.alibaba.fastjson.JSONObject; //導入方法依賴的package包/類
/**
 * 根據key獲取返回對象data中的Boolean值(隻是第一層key),需要soa響應狀態碼是0
 *
 * @param result
 * @param key
 * @return
 * @author xuxiao
 * @created 2014年5月7日 下午6:00:25
 */
public static Boolean getBooleanFromDataByKey(final String result, final String key) {
    final JSONObject data = getDataObj(result);
    if (null != data) {
        return data.getBoolean(key);
    } else {
        return Boolean.FALSE;
    }
}
 
開發者ID:AsuraTeam,項目名稱:asura,代碼行數:18,代碼來源:SOAResParseUtil.java


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