MCPcopy Create free account
hub / github.com/MCBans/MCBans / getInt

Method getInt

src/main/java/com/mcbans/plugin/org/json/JSONObject.java:512–522  ·  view source on GitHub ↗

Get the int value associated with a key. @param key A key string. @return The integer value. @throws JSONException if the key is not found or if the value cannot be converted to an integer.

(String key)

Source from the content-addressed store, hash-verified

510 * be converted to an integer.
511 */
512 public int getInt(String key) throws JSONException {
513 Object object = get(key);
514 try {
515 return object instanceof Number ?
516 ((Number)object).intValue() :
517 Integer.parseInt((String)object);
518 } catch (Exception e) {
519 throw new JSONException("JSONObject[" + quote(key) +
520 "] is not an int.");
521 }
522 }
523
524
525 /**

Callers 1

optIntMethod · 0.95

Calls 2

getMethod · 0.95
quoteMethod · 0.95

Tested by

no test coverage detected