casts a Object to null

@param value
@param defaultValue
@return to null from Object
481065
public static Object toNull(Object value, Object defaultValue) {
	if (value == null) return null;
	if (value instanceof String && Caster.toString(value, "").trim().length() == 0) return null;
	if (value instanceof Number && ((Number) value).intValue() == 0) return null;
	return defaultValue;
    }
965261
function defaultIfEmpty(defaultValue) {
    if (defaultValue === void 0) {
        defaultValue = null;
    }
    return function (source) { return source.lift(new DefaultIfEmptyOperator(defaultValue)); };
}
810958
private String ifEmptyUseDefault(String firstValue, String defaultValue) {
        return StringUtils.ifEmpty(firstValue, defaultValue);
    }
896622
public static int parseIntOrDefault(final String value, final int defaultValue)
    {
        if (null == value)
        {
            return defaultValue;
        }

        return Integer.parseInt(value);
    }
850356
public static JsonObject getObject(JsonObject object, String field, JsonObject defaultValue) {
        final JsonValue value = object.get(field);
        if (value == null || value.isNull()) {
            return defaultValue;
        } else {
            return value.asObject();
        }
    }
255812
public static DefaultValueFunction defaultValue(Field field, Object defaultValue) {

		Assert.notNull(field, "Field must not be 'null' for default value operation.");

		return new DefaultValueFunction(field, defaultValue);
	}
787795
public T convert(Object value)
    {
        T result = null;
        if (value != null)
        {
            if (getValueClass().isInstance(value))
                result = getValueClass().cast(value);
            else
                result = convertFromString(value.toString());
        }
        return result;
    }
103795
public static Object getCastingValue(ColumnType columnType, Object value) throws ExecutionException {
        validateInput(columnType);
        Object returnValue = null;
        if (value != null) {
            switch (columnType.getDataType()) {

                case BIGINT:
                    ensureNumber(value);
                    returnValue = ((Number) value).longValue();
                    break;
                case DOUBLE:
                    ensureNumber(value);
                    returnValue = ((Number) value).doubleValue();
                    break;
                case FLOAT:
                    ensureNumber(value);
                    returnValue = ((Number) value).floatValue();
                    break;
                case INT:
                    ensureNumber(value);
                    returnValue = ((Number) value).intValue();
                    break;
                default:
                    returnValue = value;

            }
        }

        return returnValue;
    }
873698
public static Long toLongObject(@Nullable String str, Long defaultValue) {
		if (StringUtils.isEmpty(str)) {
			return defaultValue;
		}
		try {
			return Long.valueOf(str);
		} catch (final NumberFormatException nfe) {
			return defaultValue;
		}
	}
1061722
public static Float checkNull(Float value, Float elseValue) {
        return isNull(value) ? elseValue : value;
    }
734778
public static Object loadInstance(Class clazz, Object defaultValue) {
	try {
	    return clazz.newInstance();
	}
	catch (Throwable t) {
	    ExceptionUtil.rethrowIfNecessary(t);
	    return defaultValue;
	}
    }
1051747
public static Float toFloat(Object value, Float defaultValue) {
		return convert(Float.class, value, defaultValue);
	}
579865
static void registerDefaultValues(AnnotationClassValue<?> annotation, Map<String, Object> defaultValues) {
        if (defaultValues != null) {
            registerDefaultValues(annotation.getName(), defaultValues);
        }
        registerAnnotationType(annotation);
    }
331596
Object getDefaultValue(Session session) {

        return defaultExpression == null ? null
                                         : defaultExpression.getValue(session,
                                         dataType);
    }
768165
public static Integer toInteger(Object value, Integer defaultValue) {
        try {
            return toInteger(value);
        } catch (Exception e) {
            return defaultValue;
        }
    }
1061209
public static Byte toByte(Object value, Byte defaultValue) {
		return convert(Byte.class, value, defaultValue);
	}
18512
public static int toInteger(Object value, int defaultValue) {
		if (value == null || value.toString().trim().equals("")) {
			return defaultValue;
		}
		if (value instanceof Integer) {
			return (Integer) value;
		}
		return (int) JKConversionUtil.toDouble(value);
	}