List of utility methods to do Integer Create
Integer | toInteger(Object ob, Integer defaultInteger) to Integer if (ob == null) { return defaultInteger; if (ob instanceof Integer) { return ((Integer) ob).intValue(); } else if (ob instanceof Float) { return ((Float) ob).intValue(); } else if (ob instanceof Double) { ... |
Integer | toInteger(Object obj) to Integer if (obj instanceof String) return Integer.parseInt((String) obj); if (obj instanceof Byte) { Byte b = (Byte) obj; return b.intValue(); if (obj instanceof Short) { Short s = (Short) obj; ... |
int | toInteger(Object obj) Get the integer value of this object, only if the object is an instance of Number return (obj instanceof Number) ? ((Number) obj).intValue() : 0; |
int | toInteger(Object obj) Converts an Object to an int .
Integer result = toIntegerObject(obj);
return result == null ? 0 : result.intValue();
|
Integer | toInteger(Object object) to Integer Integer integerValue; if (object instanceof String) { integerValue = Integer.valueOf((String) object); } else if (object instanceof Number) { integerValue = ((Number) object).intValue(); } else if (object == null) { integerValue = null; } else { ... |
Integer | toInteger(Object object) to Integer Integer l = null; if (object != null) { if (object instanceof Integer) l = (Integer) object; else if (object instanceof String) l = Integer.valueOf((String) object); return l; ... |
int | toInteger(Object object, int defaultValue) Extract the value represented by the given object (Number or String). if (object == null) { return defaultValue; if (object instanceof Number) { return ((Number) object).intValue(); try { Double value = Double.valueOf(object.toString().trim()); ... |
Integer | toInteger(Object object, Integer defaultValue) to Integer if (object == null) { return defaultValue; if (object instanceof Number) { return ((Number) object).intValue(); try { Double value = Double.valueOf(object.toString().trim()); ... |
int | toInteger(Object str) to Integer return str == null ? 0 : str instanceof Number ? ((Number) str).intValue() : toInteger(str.toString()); |
Integer | toInteger(Object val) to Integer return toLong(val).intValue(); |