检查是否为有效的数字<br>
检查Double和Float是否为无限大，或者Not a Number<br>
非数字类型和Null将返回true

@param obj 被检查类型
@return 检查结果，非数字类型和Null将返回true
979629
public static boolean isValidIfNumber(Object obj) {
		if (obj != null && obj instanceof Number) {
			if (obj instanceof Double) {
				if (((Double) obj).isInfinite() || ((Double) obj).isNaN()) {
					return false;
				}
			} else if (obj instanceof Float) {
				if (((Float) obj).isInfinite() || ((Float) obj).isNaN()) {
					return false;
				}
			}
		}
		return true;
	}
352173
@Override
    public float getFloat(int columnIndex) throws SQLException {
        checkColumnBounds(columnIndex);
        try {
            final VoltType type = table.getColumnType(columnIndex - 1);
            Double doubleValue = null;
            switch(type) {
            case TINYINT:
                doubleValue = new Double(table.getLong(columnIndex - 1));
                break;
            case SMALLINT:
                doubleValue = new Double(table.getLong(columnIndex - 1));
                break;
            case INTEGER:
                doubleValue = new Double(table.getLong(columnIndex - 1));
                break;
            case BIGINT:
                doubleValue = new Double(table.getLong(columnIndex - 1));
                break;
            case FLOAT:
                doubleValue = new Double(table.getDouble(columnIndex - 1));
                break;
            case DECIMAL:
                doubleValue = table.getDecimalAsBigDecimal(columnIndex - 1).doubleValue();
                break;
            default:
                throw new IllegalArgumentException("Cannot get float value for column type '" + type + "'");
            }

            if (table.wasNull()) {
                doubleValue = new Double(0);
            } else if (Math.abs(doubleValue) > new Double(Float.MAX_VALUE)) {
                throw new SQLException("Value out of float range");
            }
            return doubleValue.floatValue();
        } catch (Exception x) {
            throw SQLError.get(x);
        }
    }
344080
@Override
    public final float getFloat(final int i) {
        double val = this.array.optDouble(i, Double.MAX_VALUE);
        if (val == Double.MAX_VALUE) {
            throw new ObjectMissingException(this, "[" + i + "]");
        }
        return (float) val;
    }
1078917
public static boolean isPrimitive(Object object) {
    if (object == null) {
      return false;
    }

    Class<?> type = object.getClass();

    return object instanceof String || (object instanceof Integer || Integer.TYPE.equals(type))
        || (object instanceof Boolean || Boolean.TYPE.equals(type))
        || (object instanceof Long || Long.TYPE.equals(type)) || (object instanceof Double || Double.TYPE.equals(type))
        || (object instanceof Float || Float.TYPE.equals(type)) || (object instanceof Byte || Byte.TYPE.equals(type))
        || (object instanceof Short || Short.TYPE.equals(type))
        || (object instanceof Character || Character.TYPE.equals(type));
  }
1075621
protected boolean isFloatingPointNumber(Object val) {
    if (val instanceof Float || val instanceof Double) {
      return true;
    }
    if (val instanceof String) {
      String string = (String) val;
      return string.indexOf('.') != -1 || string.indexOf('e') != -1 || string.indexOf('E') != -1;
    }
    return false;
  }
1104477
public static boolean isValued(Object obj) {
		if (obj == null) return false;
		if (obj instanceof String) return isStringValued((String) obj);
		return true;
	}
610408
public static float toFloat(final Object value) {
		if (value instanceof Float) {
			return (float) value;
		}
		if (value == null) {
			return 0;
		}
		return new Float(value.toString());
	}
293004
public int indexOf(Object obj) {
        if (obj instanceof JavascriptObject) {
            return checkInteger(invokeJavascript("indexOf", ((JavascriptObject) obj).getJSObject()), -1);
        }
        return checkInteger(invokeJavascript("indexOf", obj), -1);
    }
261065
public static boolean isNumeric(Object obj) {
		if (obj == null) {
			return false;
		}
		char[] chars = obj.toString().toCharArray();
		int length = chars.length;
		if(length < 1)
			return false;
		
		int i = 0;
		if(length > 1 && chars[0] == '-')
			i = 1;
		
		for (; i < length; i++) {
			if (!Character.isDigit(chars[i])) {
				return false;
			}
		}
		return true;
	}
285818
public static boolean isObject( Object obj ) {
      return !isNumber( obj ) && !isString( obj ) && !isBoolean( obj ) && !isArray( obj )
            && !isFunction( obj ) || isNull( obj );
   }
1282759
public Double asDoubleObj() {
		if (current == null)
			return null;
		if (current instanceof Number) {
			if (current instanceof Double)
				return (Double) current;
			return Double.valueOf(((Number) current).doubleValue());
		}
		return Double.NaN;
	}
667309
public static boolean asBoolean(Object obj) {

        if (obj == null) {

            return false; // 空值永远表示无效

        } else if (obj instanceof CharSequence) {

            return ((CharSequence) obj).length() > 0; // 字符串类型, 长度 > 0 表示有效

        } else if (obj instanceof Number) {

            return ((Number) obj).doubleValue() > 0; // 数字类型, >= 0 表示有效

        } else if (obj instanceof Boolean) {

            return ((Boolean) obj).booleanValue(); // Boolean 类型, true 表示有效

        } else if (obj instanceof Collection<?>) {

            return ((Collection<?>) obj).size() > 0; // 容器类型, 对象数量 > 0 表示有效

        } else if (obj.getClass().isArray()) {

            return Array.getLength(obj) > 0; // 数组类型, 对象数量 > 0 表示有效
        }

        return true; // 任意对象，引用不为空就判定有效
    }
1099114
public static Double toDoubleObject(@NotNull String str) {
		// 统一行为，不要有时候抛NPE，有时候抛NumberFormatException
		if (str == null) {
			throw new NumberFormatException("null");
		}
		return Double.valueOf(str);
	}
401910
public boolean isNumber() {
		if (type == Byte.TYPE || type == Short.TYPE || type == Integer.TYPE
				|| type == Long.TYPE || type == Float.TYPE
				|| type == Double.TYPE) {
			return true;
		} else {
			return isRawTypeSubOf(Number.class);
		}
	}
160358
public static boolean isNull( Object obj ) {
      if( obj instanceof JSONObject ){
         return ((JSONObject) obj).isNullObject();
      }
      return JSONNull.getInstance()
            .equals( obj );
   }
966533
public Float asFloatObj() {
		if (current == null)
			return null;
		if (current instanceof Number) {
			if (current instanceof Float)
				return (Float) current;
			return Float.valueOf(((Number) current).floatValue());
		}
		return Float.NaN;
	}
984622
public static float getFloat(JSONValue value) {
        if (value == null)
            return 0;
        if (!(value instanceof Number))
            throw new JSONException(NOT_A_NUMBER);
        return ((Number)value).floatValue();
    }