MCPcopy Create free account
hub / github.com/M66B/FairEmail / getInt

Method getInt

app/src/main/java/com/sun/mail/util/PropUtil.java:135–150  ·  view source on GitHub ↗

Interpret the value object as an integer, returning def if unable.

(Object value, int def)

Source from the content-addressed store, hash-verified

133 * returning def if unable.
134 */
135 private static int getInt(Object value, int def) {
136 if (value == null)
137 return def;
138 if (value instanceof String) {
139 try {
140 String s = (String)value;
141 if (s.startsWith("0x"))
142 return Integer.parseInt(s.substring(2), 16);
143 else
144 return Integer.parseInt(s);
145 } catch (NumberFormatException nfex) { }
146 }
147 if (value instanceof Integer)
148 return ((Integer)value).intValue();
149 return def;
150 }
151
152 /**
153 * Interpret the value object as a boolean,

Callers 2

getIntPropertyMethod · 0.95
getIntSessionPropertyMethod · 0.95

Calls 1

parseIntMethod · 0.45

Tested by

no test coverage detected