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


Java Convert.parseAccountId方法代码示例

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


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

示例1: processRequest

import nxt.util.Convert; //导入方法依赖的package包/类
@Override
JSONStreamAware processRequest(HttpServletRequest req) {
    String accountValue = Convert.emptyToNull(req.getParameter("account"));
    if (accountValue == null) {
        return MISSING_ACCOUNT;
    }
    try {
        long accountId = Convert.parseAccountId(accountValue);
        if (accountId == 0) {
            return INCORRECT_ACCOUNT;
        }
        JSONObject response = new JSONObject();
        JSONData.putAccount(response, "account", accountId);
        return response;
    } catch (RuntimeException e) {
        return INCORRECT_ACCOUNT;
    }
}
 
开发者ID:muhatzg,项目名称:burstcoin,代码行数:19,代码来源:RSConvert.java

示例2: getRecipientId

import nxt.util.Convert; //导入方法依赖的package包/类
static long getRecipientId(HttpServletRequest req) throws ParameterException {
    String recipientValue = Convert.emptyToNull(req.getParameter("recipient"));
    if (recipientValue == null || "0".equals(recipientValue)) {
        throw new ParameterException(MISSING_RECIPIENT);
    }
    long recipientId;
    try {
        recipientId = Convert.parseAccountId(recipientValue);
    } catch (RuntimeException e) {
        throw new ParameterException(INCORRECT_RECIPIENT);
    }
    if (recipientId == 0) {
        throw new ParameterException(INCORRECT_RECIPIENT);
    }
    return recipientId;
}
 
开发者ID:muhatzg,项目名称:burstcoin,代码行数:17,代码来源:ParameterParser.java

示例3: processRequest

import nxt.util.Convert; //导入方法依赖的package包/类
@Override
JSONStreamAware processRequest(JSONObject request, Peer peer) {
	
	JSONObject response = new JSONObject();
	
	try {
		Long accountId = Convert.parseAccountId((String)request.get("account"));
		Account account = Account.getAccount(accountId);
		JSONArray transactions = new JSONArray();
		if(account != null) {
			DbIterator<? extends Transaction> iterator = Nxt.getBlockchain().getTransactions(account, 0, (byte)-1, (byte)0, 0, 0, 9);
			while(iterator.hasNext()) {
				Transaction transaction = iterator.next();
				transactions.add(nxt.http.JSONData.transaction(transaction));
			}
		}
		response.put("transactions", transactions);
	}
	catch(Exception e) {
	}
	
	return response;
}
 
开发者ID:muhatzg,项目名称:burstcoin,代码行数:24,代码来源:GetAccountRecentTransactions.java

示例4: processRequest

import nxt.util.Convert; //导入方法依赖的package包/类
@Override
JSONStreamAware processRequest(JSONObject request, Peer peer) {
	
	JSONObject response = new JSONObject();
	
	try {
		Long accountId = Convert.parseAccountId((String)request.get("account"));
		Account account = Account.getAccount(accountId);
		if(account != null) {
			response.put("balanceNQT", Convert.toUnsignedLong(account.getBalanceNQT()));
		}
		else {
			response.put("balanceNQT", "0");
		}
	}
	catch(Exception e) {
	}
	
	return response;
}
 
开发者ID:muhatzg,项目名称:burstcoin,代码行数:21,代码来源:GetAccountBalance.java

示例5: processRequest

import nxt.util.Convert; //导入方法依赖的package包/类
@Override
JSONStreamAware processRequest(HttpServletRequest req) {

    String accountIdString = Convert.emptyToNull(req.getParameter("account"));
    long accountId = 0;

    if (accountIdString != null) {
        try {
            accountId = Convert.parseAccountId(accountIdString);
        } catch (RuntimeException e) {
            return INCORRECT_ACCOUNT;
        }
    }

    JSONArray transactions = new JSONArray();
    try (DbIterator<? extends Transaction> transactionsIterator = Nxt.getTransactionProcessor().getAllUnconfirmedTransactions()) {
        while (transactionsIterator.hasNext()) {
            Transaction transaction = transactionsIterator.next();
            if (accountId != 0 && !(accountId == transaction.getSenderId() || accountId == transaction.getRecipientId())) {
                continue;
            }
            transactions.add(JSONData.unconfirmedTransaction(transaction));
        }
    }

    JSONObject response = new JSONObject();
    response.put("unconfirmedTransactions", transactions);
    return response;
}
 
开发者ID:muhatzg,项目名称:burstcoin,代码行数:30,代码来源:GetUnconfirmedTransactions.java

示例6: processRequest

import nxt.util.Convert; //导入方法依赖的package包/类
@Override
JSONStreamAware processRequest(HttpServletRequest req) {

    String accountIdString = Convert.emptyToNull(req.getParameter("account"));
    long accountId = 0;

    if (accountIdString != null) {
        try {
            accountId = Convert.parseAccountId(accountIdString);
        } catch (RuntimeException e) {
            return INCORRECT_ACCOUNT;
        }
    }

    JSONArray transactionIds = new JSONArray();
    try (DbIterator<? extends Transaction> transactionsIterator = Nxt.getTransactionProcessor().getAllUnconfirmedTransactions()) {
        while (transactionsIterator.hasNext()) {
            Transaction transaction = transactionsIterator.next();
            if (accountId != 0 && !(accountId == transaction.getSenderId() || accountId == transaction.getRecipientId())) {
                continue;
            }
            transactionIds.add(transaction.getStringId());
        }
    }

    JSONObject response = new JSONObject();
    response.put("unconfirmedTransactionIds", transactionIds);
    return response;
}
 
开发者ID:muhatzg,项目名称:burstcoin,代码行数:30,代码来源:GetUnconfirmedTransactionIds.java

示例7: getSellerId

import nxt.util.Convert; //导入方法依赖的package包/类
static long getSellerId(HttpServletRequest req) throws ParameterException {
    String sellerIdValue = Convert.emptyToNull(req.getParameter("seller"));
    try {
        return Convert.parseAccountId(sellerIdValue);
    } catch (RuntimeException e) {
        throw new ParameterException(INCORRECT_RECIPIENT);
    }
}
 
开发者ID:muhatzg,项目名称:burstcoin,代码行数:9,代码来源:ParameterParser.java

示例8: getBuyerId

import nxt.util.Convert; //导入方法依赖的package包/类
static long getBuyerId(HttpServletRequest req) throws ParameterException {
    String buyerIdValue = Convert.emptyToNull(req.getParameter("buyer"));
    try {
        return Convert.parseAccountId(buyerIdValue);
    } catch (RuntimeException e) {
        throw new ParameterException(INCORRECT_RECIPIENT);
    }
}
 
开发者ID:muhatzg,项目名称:burstcoin,代码行数:9,代码来源:ParameterParser.java


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