本文整理汇总了Java中us.monoid.json.JSONObject.getInt方法的典型用法代码示例。如果您正苦于以下问题:Java JSONObject.getInt方法的具体用法?Java JSONObject.getInt怎么用?Java JSONObject.getInt使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类us.monoid.json.JSONObject
的用法示例。
在下文中一共展示了JSONObject.getInt方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: loadFromJSON
import us.monoid.json.JSONObject; //导入方法依赖的package包/类
public static OnlineGame loadFromJSON(JSONObject object) throws JSONException {
return new OnlineGame(
object.getInt("id"),
RageGoServer.getPlayer(object.getInt("whites_id")),
RageGoServer.getPlayer(object.getInt("blacks_id"))
);
}
示例2: loadFromJSON
import us.monoid.json.JSONObject; //导入方法依赖的package包/类
/**
* Create an online player from server data
* @param object Server data for this Player
* @throws JSONException if server data is incorrect
* @throws IOException if server data is incorrect
* @return The player corresponding
*/
public static OnlinePlayer loadFromJSON(JSONObject object) throws IOException, JSONException {
if (object == null) return null;
int id = object.getInt("id");
final String code = object.get("code").toString();
return new OnlinePlayer(id,code);
}
示例3: loadFromJSON
import us.monoid.json.JSONObject; //导入方法依赖的package包/类
/**
* Restore an OnlineNode from a server JSONObject.
*
* @param object The object from the server.
* @param board The board where this node should be played. It only use it to set the board for {@link GameNode}
* @return The OnlineNode which represent this GameNode.
* @throws JSONException If the data from server does not contain required information.
*/
public static OnlineNode loadFromJSON(JSONObject object, GameBoard board) throws JSONException {
final int player_id = object.getInt(PLAYER_ID_KEY),
game_id = object.getInt(GAME_ID_KEY),
id = object.getInt(ID_KEY);
final String data = object.getString(DATA_KEY);
return new OnlineNode(id, player_id, game_id, data, board);
}