List of utility methods to do Integer Create
Integer | toInteger(Object val) to Integer if (val == null) return null; if (val instanceof Number) return Integer.valueOf(((Number) val).intValue()); return Integer.valueOf(val.toString().trim()); |
Integer | toInteger(Object value) Convert an Object to an Integer. if (value == null) return null; if (value instanceof Integer) return (Integer) value; if (value instanceof String) { if ("".equals((String) value)) return null; return new Integer((String) value); ... |
Integer | toInteger(Object value) to Integer return toInteger(value, null);
|
Object | toInteger(Object value) to Integer if (value instanceof Number) { return ((Number) value).intValue(); if (value instanceof String && !((String) value).isEmpty()) { return Integer.valueOf((String) value); return null; |
Integer | toInteger(Object value) to Integer if (value == null) { return 0; return Integer.parseInt(value.toString()); |
Integer | toInteger(Object value) to Integer if (value instanceof Integer) { return (Integer) value; } else if (value instanceof Number) { return ((Number) value).intValue(); } else if (value instanceof String) { try { return (int) Double.parseDouble((String) value); } catch (NumberFormatException ignored) { ... |
Integer | toInteger(Object value) to Integer try { if (value == null || EMPTY.equals(value)) { return null; return Integer.valueOf(value.toString()); } catch (Exception e) { e.printStackTrace(); return null; ... |
Integer | toInteger(Object value) to Integer if (value == null) return null; if (value instanceof Integer) return (Integer) value; if (value instanceof Number) return new Integer(((Number) value).intValue()); String svalue = toString(value); if (svalue == null) ... |
int | toInteger(Object value, int defaultValue) to Integer if (value == null) { return defaultValue; } else if (value instanceof Number) { return ((Number) value).intValue(); } else { return Integer.parseInt(value.toString()); |
Integer | toInteger(Object x) to Integer if (x == null) return null; if (x instanceof Integer) return (Integer) x; if (x instanceof Long) return Integer.valueOf(x.toString()); if (x instanceof String) return Integer.valueOf((String) x); ... |