Class JarSearcher

java.lang.Object
me.deecaad.core.file.JarSearcher
Direct Known Subclasses:
JarInstancer, SerializerInstancer

public class JarSearcher extends Object
This immutable class outlines a searcher that iterates through the files of a JarFile.
  • Constructor Details

  • Method Details

    • findAllSubclasses

      public <T> List<Class<T>> findAllSubclasses(@NotNull @NotNull Class<T> clazz, @NotNull @NotNull ClassLoader clazzLoader, @NotNull @NotNull SearchMode filter)
      Returns a List of every class that inherits from the given class clazz that can be found in this searcher's JarFile.

      This is useful if addons to a plugin create an new implementation for a feature, so the main plugin doesn't have to write a registry system for each feature. Instead, the main plugin can pull all features from registered jars.

      Type Parameters:
      T - The parent class that all of these subclasses will have in common.
      Parameters:
      clazz - The class that the subclasses inherit from. This is generally an abstract class/interface.
      clazzLoader - The class that is used to load classes
      filter - The filter for which serializers to use
      Returns:
      A List of every subclass.