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


Java JSONObject.getInteger方法代码示例

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


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

示例1: setViewport

import com.alibaba.fastjson.JSONObject; //导入方法依赖的package包/类
@JSMethod(uiThread = false)
public void setViewport(String param) {
    if (!TextUtils.isEmpty(param)) {
        try {
            param = URLDecoder.decode(param, "utf-8");
            JSONObject jsObj = JSON.parseObject(param);
            if (DEVICE_WIDTH.endsWith(jsObj.getString(WIDTH))) {
                mWXSDKInstance.setViewPortWidth(WXViewUtils.getScreenWidth(mWXSDKInstance.getContext()));
            } else {
                int width = jsObj.getInteger(WIDTH);
                if (width > 0) {
                    mWXSDKInstance.setViewPortWidth(width);
                }
            }
        } catch (Exception e) {
            WXLogUtils.e("[WXModalUIModule] alert param parse error ", e);
        }
    }
}
 
开发者ID:erguotou520,项目名称:weex-uikit,代码行数:20,代码来源:WXMetaModule.java

示例2: register

import com.alibaba.fastjson.JSONObject; //导入方法依赖的package包/类
/**
 * 注册
 *
 * @param serverId 服务ID
 * @param port  服务端口号
 */
public void register(String serverId, String port) {
    this.sessionId = getRandomString();
    this.serverId = serverId;
    this.port = port;
    // 发送注册请求
    try {
        String resp = HttpUtils.sendGet(String.format("http://%s/register?id=%s&sessionId=%s&port=%s",
                this.host, serverId, this.sessionId, port));
        this.status = true;
        JSONObject obj = JSON.parseObject(resp);
        if (obj.getInteger(Constant.CODE) != 0) {
            throw new ExceptionInInitializerError("register server fail");
        }
        JSONObject data = obj.getJSONObject(Constant.DATA);
        String[] tmp = data.getString("PublicKey").split("\n");
        this.publicKey = tmp[1] + tmp[2] + tmp[3] + tmp[4];
        this.length = data.getInteger("Length");
        this.timeout = data.getInteger("Timeout");
    } catch (IOException ignored) {
    }
}
 
开发者ID:cwdtom,项目名称:hermes-java,代码行数:28,代码来源:Center.java

示例3: isTeamAVChatInvite

import com.alibaba.fastjson.JSONObject; //导入方法依赖的package包/类
private boolean isTeamAVChatInvite(JSONObject json) {
    if (json != null) {
        int id = json.getInteger(KEY_ID);
        return id == ID;
    }
    return false;
}
 
开发者ID:newDeepLearing,项目名称:decoy,代码行数:8,代码来源:TeamAVChatHelper.java

示例4: executeSqlRule

import com.alibaba.fastjson.JSONObject; //导入方法依赖的package包/类
@POST
@Path("/executeSqlRule")
public Response executeSqlRule(String param) {
    System.out.println(param);
    JSONObject map = JSON.parseObject(param);
    String sql = map.getString("sql");
    int length = map.getInteger("length");
    List<List<String>> data = new ArrayList<>();
    for(int i=0;i<length;i++) {
        data.add((List<String>)map.get("data["+i+"][]"));
    }

    try {
        Properties properties = PropertiesUtils.getProps("mybatis.properties");
        DbusDataSource source = new DbusDataSource();
        source.setDsType("mysql");
        source.setMasterURL(properties.get("url").toString());
        source.setDbusUser(properties.get("username").toString());
        source.setDbusPassword(properties.get("password").toString());
        TableFetcher fetcher = TableFetcher.getFetcher(source);
        List<List<String>> result = fetcher.doSqlRule(sql, data);
        return Response.ok().entity(result).build();
    } catch (Exception e) {
        logger.error("Error encountered while execute sql rule, error message:{}", e);
        return Response.status(204).entity(new Result(-1, e.getMessage())).build();
    }
}
 
开发者ID:BriData,项目名称:DBus,代码行数:28,代码来源:DataTableResource.java

示例5: setNavBarHidden

import com.alibaba.fastjson.JSONObject; //导入方法依赖的package包/类
@JSMethod
public void setNavBarHidden(String param, final String callback) {
    String message = MSG_FAILED;
    try {
        JSONObject jsObj = JSON.parseObject(param);
        int visibility = jsObj.getInteger(Constants.Name.NAV_BAR_VISIBILITY);
        boolean success = changeVisibilityOfActionBar(mWXSDKInstance.getContext(), visibility);
        if (success) {
            message = MSG_SUCCESS;
        }
    } catch (JSONException e) {
        WXLogUtils.e(TAG, WXLogUtils.getStackTrace(e));
    }
    WXBridgeManager.getInstance().callback(mWXSDKInstance.getInstanceId(), callback, message);
}
 
开发者ID:natjs,项目名称:nat-explorer,代码行数:16,代码来源:NavigatorModule.java

示例6: pop

import com.alibaba.fastjson.JSONObject; //导入方法依赖的package包/类
@JSMethod
public void pop(String encodeParam, JSCallback callback) {
    if (TextUtils.isEmpty(encodeParam)) {
        return;
    }
    JSONObject options = JSON.parseObject(encodeParam);
    int index = 0;
    String tagCode = "";
    String param = "";
    if (options.containsKey("index")) {
        index = options.getInteger("index");
    }
    if (options.containsKey("tagCode")) {
        tagCode = options.getString("tagCode");
    }
    if (options.containsKey("param")) {
        param = options.getString("param");
    }
    Activity activity = (Activity) mWXSDKInstance.getContext();
    if (mWXSDKInstance.getContext() instanceof Activity) {
        if (TextUtils.isEmpty(param)) {
            ((Activity) mWXSDKInstance.getContext()).finish();
        } else {
            Bundle bundle = new Bundle();
            bundle.putString("params", encodeParam);
            bundle.putString("backTag", tagCode);
            WXActivityManager.getInstance().backToActivity(activity, index, bundle);
            //发出全局广播
            Intent eventIntent = new Intent(WXGlobalEventReceiver.EVENT_ACTION);
            eventIntent.putExtra(WXGlobalEventReceiver.EVENT_NAME, tagCode);
            eventIntent.putExtra(WXGlobalEventReceiver.EVENT_PARAMS, encodeParam);
            mWXSDKInstance.getContext().sendBroadcast(eventIntent);
            if (callback != null) {
                callback.invoke(MSG_SUCCESS);
            }
        }
    }
}
 
开发者ID:weexext,项目名称:ucar-weex-core,代码行数:39,代码来源:UWXNavigatorModule.java

示例7: convert

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

    final ArrayList<MultipleItemEntity> dataList = new ArrayList<>();
    final JSONArray dataArray = JSON.parseObject(getJsonData()).getJSONArray("data");

    final int size = dataArray.size();
    for (int i = 0; i < size; i++) {
        final JSONObject data = dataArray.getJSONObject(i);
        final String thumb = data.getString("thumb");
        final String desc = data.getString("desc");
        final String title = data.getString("title");
        final int id = data.getInteger("id");
        final int count = data.getInteger("count");
        final double price = data.getDouble("price");

        final MultipleItemEntity entity = MultipleItemEntity.builder()
                .setField(MultipleFields.ITEM_TYPE, ShopCartItemType.SHOP_CART_ITEM)
                .setField(MultipleFields.ID, id)
                .setField(MultipleFields.IMAGE_URL, thumb)
                .setField(ShopCartItemFields.TITLE, title)
                .setField(ShopCartItemFields.DESC, desc)
                .setField(ShopCartItemFields.COUNT, count)
                .setField(ShopCartItemFields.PRICE, price)
                .setField(ShopCartItemFields.IS_SELECTED, false)
                .setField(ShopCartItemFields.POSITION, i)
                .build();

        dataList.add(entity);
    }

    return dataList;
}
 
开发者ID:remerber,项目名称:FastEc,代码行数:34,代码来源:ShopCartDataConverter.java

示例8: convert

import com.alibaba.fastjson.JSONObject; //导入方法依赖的package包/类
final List<SectionBean> convert(String json) {
    final List<SectionBean> dataList = new ArrayList<>();
    final JSONArray dataArray = JSON.parseObject(json).getJSONArray("data");

    final int size = dataArray.size();
    for (int i = 0; i < size; i++) {
        final JSONObject data = dataArray.getJSONObject(i);
        final int id = data.getInteger("id");
        final String title = data.getString("section");

        //添加title
        final SectionBean sectionTitleBean = new SectionBean(true, title);
        sectionTitleBean.setId(id);
        sectionTitleBean.setIsMore(true);
        dataList.add(sectionTitleBean);

        final JSONArray goods = data.getJSONArray("goods");
        //商品内容循环
        final int goodSize = goods.size();
        for (int j = 0; j < goodSize; j++) {
            final JSONObject contentItem = goods.getJSONObject(j);
            final int goodsId = contentItem.getInteger("goods_id");
            final String goodsName = contentItem.getString("goods_name");
            final String goodsThumb = contentItem.getString("goods_thumb");
            //获取内容
            final SectionContentItemEntity itemEntity = new SectionContentItemEntity();
            itemEntity.setGoodsId(goodsId);
            itemEntity.setGoodsName(goodsName);
            itemEntity.setGoodsThumb(goodsThumb);
            //添加内容
            dataList.add(new SectionBean(itemEntity));
        }
        //商品内容循环结束
    }
    //Section循环结束

    return dataList;
}
 
开发者ID:remerber,项目名称:FastEc,代码行数:39,代码来源:SectionDataConverter.java

示例9: pinch

import com.alibaba.fastjson.JSONObject; //导入方法依赖的package包/类
private static boolean pinch(JSONObject args) throws Exception {
    String elementId = args.getString("element");
    Element el;
    if (elementId == null) {
        el = elements.getElement("1");
    } else {
        el = elements.getElement(elementId);
    }
    String direction = args.getString("direction");
    float percent = args.getFloat("percent");
    int steps = args.getInteger("steps");
    return el.pinch(direction, percent, steps);
}
 
开发者ID:macacajs,项目名称:UIAutomatorWD,代码行数:14,代码来源:ActionController.java

示例10: 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

示例11: getStartIdByJobId

import com.alibaba.fastjson.JSONObject; //导入方法依赖的package包/类
/**
* 根据作业id获取该作业的开始控件id <br/>
* @author jingma
* @param dbCode
* @param jobId
* @return
*/
public static Integer getStartIdByJobId(String dbCode, int jobId) {
    //START控件的类型编号是74,每个JOB只有一个START控件,所有可以唯一确定
    String sql = "select je.id_jobentry from r_jobentry je where "
            + "je.id_job=? and je.id_jobentry_type=?";
    JSONObject startIdObj = Db.use(dbCode).findFirst(sql, jobId,startTypeId);
    if(startIdObj == null){
        return null;
    }
    Integer startId = startIdObj.getInteger("id_jobentry");
    return startId;
}
 
开发者ID:majinju,项目名称:KettleUtil,代码行数:19,代码来源:TimingUtil.java

示例12: testJsonParse

import com.alibaba.fastjson.JSONObject; //导入方法依赖的package包/类
@Test
public void testJsonParse() {
    JsonData jsonData = new JsonData("{\"age\":23,\"name\":\"hcc\", \"height\":172 ,\"weight\":\"62\"}");
    JSONObject jsonObject = jsonData.getJsonObject();

    int age = jsonObject.getInteger("age");
    Assert.assertEquals(23 , age);

    String name = jsonObject.getString("name");
    Assert.assertEquals("hcc" , name);

    int weight = jsonObject.getIntValue("weight");
    Assert.assertEquals(62 , weight);
}
 
开发者ID:doubleview,项目名称:fastcrawler,代码行数:15,代码来源:JsonDataTest.java

示例13: tap

import com.alibaba.fastjson.JSONObject; //导入方法依赖的package包/类
private static boolean tap(JSONObject args) throws Exception {
    String elementId = args.getString("element");
    if (elementId != null) {
        Element el = elements.getElement(elementId);
        return el.tap();
    } else {
        int x = args.getInteger("x");
        int y = args.getInteger("y");
        return mDevice.click(x, y);
    }
}
 
开发者ID:macacajs,项目名称:UIAutomatorWD,代码行数:12,代码来源:ActionController.java

示例14: around

import com.alibaba.fastjson.JSONObject; //导入方法依赖的package包/类
/**配置环绕通知,使用在方法aspect()上注册的切入点*/
@Around("aspect()")
public Object around(ProceedingJoinPoint pjd) {
	HttpServletRequest request = ((ServletRequestAttributes)RequestContextHolder.getRequestAttributes()).getRequest();
       Object result = null;
       //执行目标方法
       try {
           //前置通知
           result = pjd.proceed();
           if(Statics.Record_System_Log){
           	if(result instanceof ReturnUtil){
           		List<JSONObject> operationLogs = ReflectHelperUtil.getInstance(result, "operation_logs");
           		if(operationLogs==null)operationLogs = new ArrayList<JSONObject>();
       			if(Statics.Record_Select_System_Log || (!Statics.Record_Select_System_Log && operationLogs.size()>0)){
           			if(request.getAttribute(Statics.SYSTEM_LOG_ID)!=null && !request.getAttribute(Statics.SYSTEM_LOG_ID).toString().equals("")){
           				//-----添加系统日志begin-----
           				JSONObject log = JSONObject.parseObject(request.getAttribute(Statics.SYSTEM_LOG_ID).toString());
           				log.put("result", JSONObject.toJSONString(result));
           				long systemLogId = Long.parseLong(AuthorityAnnotationInterceptor.myBaseService.add(null,log, "systemMapper.addSystemLog", true).getExtend_info().toString());
           				//-----添加系统日志end-----
           				JSONObject memberJson = StorageUtil.init(request.getSession()).getLoginMemberInfoJson();
           				if(memberJson!=null && operationLogs.size()>0){
           					for (int i = 0,length=operationLogs.size(); i < length; i++) {
								JSONObject operationLog = operationLogs.get(i);
								if(operationLog.getInteger("operation_type")!=3){
									//-----添加操作日志begin-----
									operationLog.put("system_log_id", systemLogId);
									operationLog.put("memberId", memberJson.getLong("id"));
									AuthorityAnnotationInterceptor.myBaseService.add(null,operationLog, "systemMapper.addOperationLog",true);
									//-----添加操作日志end-----
								}
							}
           				}
           			}
           		}
           	}
           }
           request.removeAttribute("Statics.SYSTEM_LOG_ID");
           //返回通知
       } catch (Throwable e) {
           //异常通知
       	if(result instanceof ReturnUtil){
       		result = ((ReturnUtil) result).addSeriousErrorMsg("发生异常:"+e.toString());
       	}else{
       		throw new RuntimeException(e);
       	}
       	e.printStackTrace();
       }
       //后置通知
       if(Statics.out_implement_time){
       	long implement_time =System.currentTimeMillis() - Long.parseLong(request.getAttribute("start_implement_time").toString());
       	System.out.println(request.getAttribute("implement_method_name")+"方法处理时间:"+implement_time+"毫秒。");
       }
       return result;
   }
 
开发者ID:zhiqiang94,项目名称:BasicsProject,代码行数:56,代码来源:SystemLogAop.java

示例15: TestSetSignerWeight

import com.alibaba.fastjson.JSONObject; //导入方法依赖的package包/类
public static void TestSetSignerWeight(String url, String srcAddress, String srcPrivate, String srcPublic, String signAddress,
		int signWeight) {
	try {
		// get hash type
		String getHello = url + "/hello";
		String hello = HttpKit.post(getHello, "");
		JSONObject ho = JSONObject.parseObject(hello);
		Integer hash_type = ho.containsKey("hash_type") ? ho.getInteger("hash_type") : 0;
		
		// getAccount
		String getAccount = url + "/getAccount?address=" + srcAddress;
		String txSeq = HttpKit.post(getAccount, "");
		JSONObject tx = JSONObject.parseObject(txSeq);
		String seq_str = tx.getJSONObject("result").containsKey("nonce") ? tx.getJSONObject("result").getString("nonce") : "0";
		long nonce = Long.parseLong(seq_str);
		
		// use src account sign
		BubiKey bubiKey_src = new BubiKey(srcPrivate, srcPublic);
		
		// generate transaction
		Transaction.Builder tran = Transaction.newBuilder();
		tran.setSourceAddress(srcAddress);
		tran.setNonce(nonce + 1);
		Operation.Builder oper = tran.addOperationsBuilder();
		oper.setType(Operation.Type.SET_SIGNER_WEIGHT);
		OperationSetSignerWeight.Builder signerWeight = OperationSetSignerWeight.newBuilder();
		Signer.Builder signer = signerWeight.addSignersBuilder();
		signer.setAddress(signAddress);
		signer.setWeight(signWeight);
		oper.setSetSignerWeight(signerWeight);
		
		// generate hex string of transaction's hash
		String hash = HashUtil.GenerateHashHex(tran.build().toByteArray(), hash_type);
		System.out.println("hash: " + hash);
		
		// add transaction with signature
		JSONObject request = new JSONObject();
		JSONArray items = new JSONArray();
		JSONObject item = new JSONObject();
		item.put("transaction_blob", cn.bubi.baas.utils.encryption.utils.HexFormat.byteToHex(tran.build().toByteArray()));
		JSONArray signatures = new JSONArray();
		JSONObject signature = new JSONObject();
		signature.put("sign_data", cn.bubi.baas.utils.encryption.utils.HexFormat.byteToHex(bubiKey_src.sign(tran.build().toByteArray())));
		signature.put("public_key", srcPublic);
		signatures.add(signature);
		item.put("signatures", signatures);
		items.add(item);
		request.put("items", items);
		
		String submitTransaction = url + "/submitTransaction";
		String result = HttpKit.post(submitTransaction, request.toJSONString());
		System.out.println(result);
		
	} catch (Exception e) {
		e.printStackTrace();
	}
}
 
开发者ID:bubicn,项目名称:bubichain-sdk-java,代码行数:58,代码来源:TestBubikey.java


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