private static Object convertToPrimitive()

in gflog-core/src/main/java/com/epam/deltix/gflog/core/LogConfigFactory.java [444:474]


    private static Object convertToPrimitive(final Class<?> type, final String value) {
        if (type == boolean.class) {
            return PropertyUtil.toBoolean(value);
        }

        if (type == long.class) {
            return PropertyUtil.toMemory(value);
        }

        if (type == int.class) {
            return Math.toIntExact(PropertyUtil.toMemory(value));
        }

        if (type == short.class) {
            return Short.parseShort(value);
        }

        if (type == byte.class) {
            return Byte.parseByte(value);
        }

        if (type == double.class) {
            return Double.parseDouble(value);
        }

        if (type == float.class) {
            return Float.parseFloat(value);
        }

        throw new IllegalArgumentException("unsupported primitive type: " + type);
    }