private static SetterClassPair findSetterClassPair(Object object, String itemName)
            throws TikaConfigException {

        //TODO -- we could do more with info from the node -- is it complex, does it have
        //a text value, does it have a class, etc...  This works for now.
        String setter =
                "set" + itemName.substring(0, 1).toUpperCase(Locale.US) + itemName.substring(1);
        Class itemClass = null;
        Method setterMethod = null;
        for (Method method : object.getClass().getMethods()) {
            if (setter.equals(method.getName())) {
                Class<?>[] classes = method.getParameterTypes();
                if (classes.length == 1) {
                    //if both setX(String) and setX(Object), prefer setX(String)
                    if (itemClass == null || classes[0].equals(String.class)) {
                        itemClass = classes[0];
                        setterMethod = method;
                    }
                }
            }
        }
        if (setterMethod != null && itemClass != null) {
            return new SetterClassPair(setterMethod, itemClass);
        }
        //now try adders
        String adder =
                "add" + itemName.substring(0, 1).toUpperCase(Locale.US) + itemName.substring(1);
        for (Method method : object.getClass().getMethods()) {
            if (adder.equals(method.getName())) {
                Class<?>[] classes = method.getParameterTypes();
                if (classes.length == 1) {
                    //if both setX(String) and setX(Object), prefer setX(String)
                    if (itemClass == null || classes[0].equals(String.class)) {
                        itemClass = classes[0];
                        setterMethod = method;
                    }
                }
            }
        }
        if (setterMethod == null && itemClass == null) {
            throw new TikaConfigException(
                    "Couldn't find setter '" + setter + "' or adder '" + adder + "' for " + itemName +
                            " of class: " + object.getClass());
        }
        return new SetterClassPair(setterMethod, itemClass);
    }
Use this to build a list of components for a composite item (e.g.
CompositeMetadataFilter, FetcherManager), each with their own configurations

@param compositeElementName
@param itemName
@param is
@throws TikaConfigException
@throws IOException
tika-core/src/main/java/org/apache/tika/config/ConfigBase.java