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

            if (clazz.isAssignableFrom(byte.class)) return (T)((Object)Byte.parseByte(value));

            if (clazz.isAssignableFrom(short.class)) return (T)((Object)Short.parseShort(value));

            if (clazz.isAssignableFrom(int.class)) return (T)((Object)Integer.parseInt(value));

            if (clazz.isAssignableFrom(long.class)) return (T)((Object)Long.parseLong(value));

            if (clazz.isAssignableFrom(float.class)) return (T)((Object)Float.parseFloat(value));

            if (clazz.isAssignableFrom(double.class)) return (T)((Object)Double.parseDouble(value));

            if (clazz.isAssignableFrom(boolean.class)) return (T)((Object)Boolean.parseBoolean(value));

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