protected volatile Map<String, ExtensionInfo> extensionInfos; // cache extension infos by class name
protected Boolean checkForExtensionDependencies = null;
- public AbstractExtensionFinder(PluginManager pluginManager) {
+ protected AbstractExtensionFinder(PluginManager pluginManager) {
this.pluginManager = pluginManager;
}
public abstract Map<String, Set<String>> readClasspathStorages();
@Override
- @SuppressWarnings("unchecked")
public <T> List<ExtensionWrapper<T>> find(Class<T> type) {
log.debug("Finding extensions of extension point '{}'", type.getName());
Map<String, Set<String>> entries = getEntries();
/**
* The plugins roots are supplied as comma-separated list by {@code System.getProperty("pf4j.pluginsDir", "plugins")}.
*/
- public AbstractPluginManager() {
+ protected AbstractPluginManager() {
initialize();
}
*
* @param pluginsRoots the roots to search for plugins
*/
- public AbstractPluginManager(Path... pluginsRoots) {
+ protected AbstractPluginManager(Path... pluginsRoots) {
this(Arrays.asList(pluginsRoots));
}
*
* @param pluginsRoots the roots to search for plugins
*/
- public AbstractPluginManager(List<Path> pluginsRoots) {
+ protected AbstractPluginManager(List<Path> pluginsRoots) {
this.pluginsRoots.addAll(pluginsRoots);
initialize();
return pluginWrapper;
}
-
+
/**
* creates the plugin wrapper. override this if you want to prevent plugins having full access to the plugin manager
- *
+ *
* @return
*/
protected PluginWrapper createPluginWrapper(PluginDescriptor pluginDescriptor, Path pluginPath, ClassLoader pluginClassLoader) {
/**
* Set to true to allow requires expression to be exactly x.y.z.
* The default is false, meaning that using an exact version x.y.z will
- * implicitly mean the same as >=x.y.z
+ * implicitly mean the same as >=x.y.z
*
* @param exactVersionAllowed set to true or false
*/
public class ClassLoadingStrategy {
/**
- * application(parent) -> plugin -> dependencies
+ * application(parent) -> plugin -> dependencies
*/
public static final ClassLoadingStrategy APD = new ClassLoadingStrategy(Arrays.asList(Source.APPLICATION, Source.PLUGIN, Source.DEPENDENCIES));
/**
- * application(parent) -> dependencies -> plugin
+ * application(parent) -> dependencies -> plugin
*/
public static final ClassLoadingStrategy ADP = new ClassLoadingStrategy(Arrays.asList(Source.APPLICATION, Source.DEPENDENCIES, Source.PLUGIN));
/**
- * plugin -> application(parent) -> dependencies
+ * plugin -> application(parent) -> dependencies
*/
public static final ClassLoadingStrategy PAD = new ClassLoadingStrategy(Arrays.asList(Source.PLUGIN, Source.APPLICATION, Source.DEPENDENCIES));
/**
- * dependencies -> application(parent) -> plugin
+ * dependencies -> application(parent) -> plugin
*/
public static final ClassLoadingStrategy DAP = new ClassLoadingStrategy(Arrays.asList(Source.DEPENDENCIES, Source.APPLICATION, Source.PLUGIN));
/**
- * dependencies -> plugin -> application(parent)
+ * dependencies -> plugin -> application(parent)
*/
public static final ClassLoadingStrategy DPA = new ClassLoadingStrategy(Arrays.asList(Source.DEPENDENCIES, Source.PLUGIN, Source.APPLICATION));
/**
- * plugin -> dependencies -> application(parent)
+ * plugin -> dependencies -> application(parent)
*/
public static final ClassLoadingStrategy PDA = new ClassLoadingStrategy(Arrays.asList(Source.PLUGIN, Source.DEPENDENCIES, Source.APPLICATION));
*/
public class ClassUtils {
+ private ClassUtils() {}
+
public static List<String> getAllInterfacesNames(Class<?> aClass) {
return toString(getAllInterfaces(aClass));
}
return list;
}
- /*
- public static List<String> getAllAbstractClassesNames(Class<?> aClass) {
- return toString(getAllInterfaces(aClass));
- }
-
- public static List getAllAbstractClasses(Class aClass) {
- List<Class<?>> list = new ArrayList<>();
-
- Class<?> superclass = aClass.getSuperclass();
- while (superclass != null) {
- if (Modifier.isAbstract(superclass.getModifiers())) {
- list.add(superclass);
- }
- superclass = superclass.getSuperclass();
- }
-
- return list;
- }
- */
-
/**
* Get a certain annotation of a {@link TypeElement}.
* See <a href="https://stackoverflow.com/a/10167558">stackoverflow.com</a> for more information.
return null;
}
- /*
- public static Element getAnnotationMirrorElement(TypeElement typeElement, Class<?> annotationClass) {
- AnnotationMirror annotationMirror = getAnnotationMirror(typeElement, annotationClass);
- return annotationMirror != null ? annotationMirror.getAnnotationType().asElement() : null;
- }
- */
-
/**
* Get a certain parameter of an {@link AnnotationMirror}.
* See <a href="https://stackoverflow.com/a/10167558">stackoverflow.com</a> for more information.
/**
* Uses {@link Class#getSimpleName()} to convert from {@link Class} to {@link String}.
- *
- * @param classes
- * @return
*/
private static List<String> toString(List<Class<?>> classes) {
List<String> list = new ArrayList<>();
*/
public class StringUtils {
+ private StringUtils() {}
+
public static boolean isNullOrEmpty(String str) {
return (str == null) || str.isEmpty();
}
<licenses>
<license>
<name>The Apache Software License, Version 2.0</name>
- <url>http://www.apache.org/licenses/LICENSE-2.0.txt</url>
+ <url>https://www.apache.org/licenses/LICENSE-2.0.txt</url>
<distribution>repo</distribution>
</license>
</licenses>
<pluginManagement>
<plugins>
<plugin>
+ <groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<version>3.8.0</version>
<configuration>
</plugin>
<plugin>
+ <groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-surefire-plugin</artifactId>
<version>2.22.1</version>
</plugin>
<plugin>
+ <groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-jar-plugin</artifactId>
<version>2.6</version>
</plugin>
</plugin>
<plugin>
+ <groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-jar-plugin</artifactId>
<configuration>
<archive>