private <T> T convertReference(String value, Class<T> clazz) {
            if (clazz.isAssignableFrom(String.class)) return clazz.cast(value);

            if (clazz.isAssignableFrom(Short.class) || clazz.isAssignableFrom(short.class))
                return clazz.cast(Short.parseShort(value));

            if (clazz.isAssignableFrom(Integer.class) || clazz.isAssignableFrom(int.class))
                return clazz.cast(Integer.parseInt(value));

            if (clazz.isAssignableFrom(Long.class) || clazz.isAssignableFrom(long.class))
                return clazz.cast(Long.parseLong(value));

            if (clazz.isAssignableFrom(Boolean.class) || clazz.isAssignableFrom(boolean.class))
                return clazz.cast(Boolean.parseBoolean(value));

            throw new RuntimeException("Unsupported type " + clazz.getCanonicalName());
        }