protected FieldValue createByReflection(Object arg) {
        Class<?> valClass = getValueClass();
        if (valClass != null) {
            Pair<Class<?>, Class<?>> key = new Pair<>(valClass, arg.getClass());
            Constructor<?> cstr = constructorCache.get(key);
            if (cstr == null) {
                if (!constructorCache.containsKey(key)) {
                    try {
                        cstr = valClass.getConstructor(key.getSecond());
                        constructorCache.put(key, cstr);
                    } catch (NoSuchMethodException e) {
                        constructorCache.put(key, null);
                    }
                }
            }
            try {
                return cstr != null ? (FieldValue)cstr.newInstance(arg) : null;
            } catch (ReflectiveOperationException e) {
                // Only rethrow exceptions coming from the underlying FieldValue constructor.
                if (e instanceof InvocationTargetException) {
                    throw new IllegalArgumentException(e.getCause().getMessage(), e.getCause());
                }
            }
        }
        return null;
    }
Creates a field value by reflection

@param arg the value of the newly created field value
@return a fully constructed value
document/src/main/java/com/yahoo/document/DataType.java