code: public Number asNumber(Object value) throws NumberFormatException {
  
          if(value instanceof Number) {
              return (Number) value;
          }
  
          String str = String.valueOf(value);
  
          return str.matches("\\d+") ? Long.valueOf(str) : Double.valueOf(str);
      }
docs: Returns `value` as a Number. Strings will be coerced into
  either a Long or Double.
  
  @param value
  the value to cast to a Number.
  
  @return `value` as a Number.
  
  @throws NumberFormatException when `value` is a String which could
  not be parsed as a Long or Double.