MCPcopy Index your code
hub / github.com/processing/processing / getInt

Method getInt

core/src/processing/data/JSONObject.java:608–619  ·  view source on GitHub ↗

Gets the int value associated with a key @webref jsonobject:method @brief Gets the int value associated with a key @param key A key string. @return The integer value. @throws RuntimeException if the key is not found or if the value cannot be converted to an integer. @see JSONObject#getFloat(String

(String key)

Source from the content-addressed store, hash-verified

606 * @see JSONObject#getBoolean(String)
607 */
608 public int getInt(String key) {
609 Object object = this.get(key);
610 if (object == null) {
611 throw new RuntimeException("JSONObject[" + quote(key) + "] not found");
612 }
613 try {
614 return object instanceof Number ?
615 ((Number)object).intValue() : Integer.parseInt((String)object);
616 } catch (Exception e) {
617 throw new RuntimeException("JSONObject[" + quote(key) + "] is not an int.");
618 }
619 }
620
621
622 /**

Callers

nothing calls this directly

Calls 3

getMethod · 0.95
quoteMethod · 0.95
parseIntMethod · 0.80

Tested by

no test coverage detected