private static Object convertAttribute()

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


    private static Object convertAttribute(final Class<?> type, final String value) throws Exception {
        if (type == String.class) {
            return value;
        }

        if (type.isPrimitive()) {
            return convertToPrimitive(type, value);
        }

        if (type.isEnum()) {
            return convertToEnum((Class<Enum>) type, value);
        }

        if (type == ZoneId.class) {
            return ZoneId.of(value);
        }

        if (type == Duration.class) {
            return PropertyUtil.toDuration(value);
        }

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