public static void serializeParams(Document doc, Element element, Object object) {
        Matcher setterMatcher = Pattern.compile("\\Aset([A-Z].*)").matcher("");
        Matcher getterMatcher = Pattern.compile("\\A(?:get|is)([A-Z].+)\\Z").matcher("");

        //TODO -- check code base for setters with lowercase initial letters?!
        MethodTuples nonPrimitiveSetters = new MethodTuples();
        MethodTuples primitiveSetters = new MethodTuples();
        MethodTuples nonPrimitiveGetters = new MethodTuples();
        MethodTuples primitiveGetters = new MethodTuples();
        for (Method method : object.getClass().getMethods()) {
            Class[] parameterTypes = method.getParameterTypes();

            if (setterMatcher.reset(method.getName()).find()) {
                if (!Modifier.isPublic(method.getModifiers())) {
                    //we could just call getMethods, but this can be helpful debugging inf
                    LOG.trace("inaccessible setter: {} in {}", method.getName(), object.getClass());
                    continue;
                }
                //require @Field on setters
                if (method.getAnnotation(Field.class) == null) {
                   // LOG.warn("unannotated setter {} in {}", method.getName(), object.getClass());
                    continue;
                }
                if (parameterTypes.length != 1) {
                    //TODO -- check code base for setX() zero parameters that set boolean to true
                    LOG.warn("setter with wrong number of params " + method.getName() + " " + parameterTypes.length);
                    continue;
                }
                String paramName = methodToParamName(setterMatcher.group(1));
                if (PRIMITIVES.containsKey(parameterTypes[0])) {
                    primitiveSetters.add(new MethodTuple(paramName, method, parameterTypes[0]));
                } else {
                    nonPrimitiveSetters.add(new MethodTuple(paramName, method, parameterTypes[0]));
                }
            } else if (getterMatcher.reset(method.getName()).find()) {
                if (parameterTypes.length != 0) {
                    //require 0 parameters for the getter
                    continue;
                }
                String paramName = methodToParamName(getterMatcher.group(1));
                if (PRIMITIVES.containsKey(method.getReturnType())) {
                    primitiveGetters.add(new MethodTuple(paramName, method, method.getReturnType()));
                } else {
                    nonPrimitiveGetters.add(new MethodTuple(paramName, method, method.getReturnType()));
                }

            }
        }

        //TODO -- remove nonprimitive setters/getters that have a string equivalent
        serializePrimitives(doc, element, object, primitiveSetters, primitiveGetters);
        serializeNonPrimitives(doc, element, object, nonPrimitiveSetters, nonPrimitiveGetters);

    }
@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