if (obj == null || obj instanceof Float || obj instanceof Double)
return ((Number) obj).doubleValue();
else if (obj == null || obj instanceof String)
return Double.parseDouble((String) obj);
else
throw new MessageFormatException(L.l("can't convert '{0}' to double",
obj.getClass().getName()));
}