protected static <T> T buildSingle(String itemName, Class<T> itemClass, Element properties,
                                       T defaultValue) throws TikaConfigException, IOException {

        NodeList children = properties.getChildNodes();
        T toConfigure = null;
        for (int i = 0; i < children.getLength(); i++) {
            Node child = children.item(i);
            if (child.getNodeType() != 1) {
                continue;
            }
            if (itemName.equals(child.getLocalName())) {
                if (toConfigure != null) {
                    throw new TikaConfigException(
                            "There can only be one " + itemName + " in a config");
                }
                T item = buildClass(child, itemName, itemClass);
                setParams(item, child, new HashSet<>());
                toConfigure = (T) item;
            }
        }
        if (toConfigure == null) {
            if (defaultValue == null) {
                throw new TikaConfigException("could not find " + itemName);
            }
            return defaultValue;
        }
        return toConfigure;
    }
Use this to build a single class, where the user specifies the instance class, e.g.
PipesIterator

@param itemName
@param properties -- the properties element in the config
@throws TikaConfigException
@throws IOException
tika-core/src/main/java/org/apache/tika/config/ConfigBase.java