private Object convertStringValueToObject(String value, Class clazz) throws BadUsageException {
        Object convertedValue = null;
        if (clazz.isEnum()) {
            convertedValue = safeEnumValueOf(clazz, value);
        } else if (Date.class.isAssignableFrom(clazz)) {
            try {
                convertedValue = formatter.parse(value);
            } catch (ParseException ex) {
                convertedValue = null;
            }
        } else if ((clazz.isPrimitive() && !clazz.equals(boolean.class))
                    || (Number.class.isAssignableFrom(clazz))){
            try {
                convertedValue = NumberFormat.getInstance().parse(value);
            } catch (ParseException ex) {
                convertedValue = null;
            }
        } else {
            convertedValue = value;
        }
        if (convertedValue != null){
            return convertedValue;
        } else {
            throw new BadUsageException(ExceptionType.BAD_USAGE_FORMAT, "Wrong format for value " + value);
        }

    }