1 10 11 package org.mule.util; 12 13 16 public class NumberUtils extends org.apache.commons.lang.math.NumberUtils 18 { 19 20 public static long toLong(Object obj) 21 { 22 if (obj == null) 23 { 24 throw new IllegalArgumentException ("Unable to convert null object to long"); 25 } 26 else if (obj instanceof String ) 27 { 28 return toLong((String )obj); 29 } 30 else if (obj instanceof Number ) 31 { 32 return ((Number )obj).longValue(); 33 } 34 else 35 { 36 throw new IllegalArgumentException ("Unable to convert object of type: " 37 + obj.getClass().getName() + " to long."); 38 } 39 } 40 41 } 42 | Popular Tags |