io.permazen.util.ImplementationsReader Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of permazen-util Show documentation
Show all versions of permazen-util Show documentation
Common utility classes used by Permazen.
/*
* Copyright (C) 2015 Archie L. Cobbs. All rights reserved.
*/
package io.permazen.util;
import com.google.common.base.Preconditions;
import com.google.common.reflect.TypeToken;
import java.io.IOException;
import java.io.InputStream;
import java.lang.reflect.Constructor;
import java.lang.reflect.InvocationTargetException;
import java.net.URL;
import java.util.ArrayList;
import java.util.Collections;
import java.util.Enumeration;
import java.util.List;
import javax.xml.namespace.QName;
import javax.xml.stream.XMLInputFactory;
import javax.xml.stream.XMLStreamException;
import javax.xml.stream.XMLStreamReader;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
/**
* Scans the classpath and parses XML descriptor files describing implementation classes.
*
*
* The XML files that this class parses look like this, for some value of {@code foobar}:
*
*
* Example:
*
* <foobar-implementations>
* <foobar-implementation class="com.example.MyFoobarImplementation"/>
* </foobar-implementations>
*
*/
public class ImplementationsReader extends AbstractXMLStreaming {
private static final QName CLASS_ATTR = new QName("class");
protected final Logger log = LoggerFactory.getLogger(this.getClass());
private final ArrayList
© 2015 - 2025 Weber Informatics LLC | Privacy Policy