private static void serializeObject(String name, Document doc, Element element,
                                        MethodTuple setter,
                                         MethodTuple getter, Object object) {

        Object item = null;
        try {
            item = getter.method.invoke(object);
        } catch (IllegalAccessException | InvocationTargetException e) {
            LOG.warn("couldn't get " + name + " on " + object.getClass(), e);
            return;
        }
        if (item == null) {
            LOG.warn("Getter {} on {} returned null", getter.name, object.getClass());
        }
        Element entry = doc.createElement(name);
        entry.setAttribute("class", item.getClass().getCanonicalName());
        element.appendChild(entry);
        serializeParams(doc, element, item);
    }
@param config  config to serialize
@param mode    serialization mode
@param writer  writer
@param charset charset
@throws Exception
tika-core/src/main/java/org/apache/tika/config/TikaConfigSerializer.java