Class ClassLoaderResourceLocator

  • All Implemented Interfaces:
    ResourceLocator

    public class ClassLoaderResourceLocator
    extends Object
    implements ResourceLocator
    This resource locator can locate resources using the class loader or a specified class. When using a specified class, the resource is searched from the package path of that class. Otherwise the resource is searched from the root.
    • Constructor Detail

      • ClassLoaderResourceLocator

        public ClassLoaderResourceLocator()
        Constructs a new resource locator that will locate resources using the class loader.
      • ClassLoaderResourceLocator

        public ClassLoaderResourceLocator​(Class<?> loadClass)
        Constructs a new resource locator that will locate resources using the specified class. If you set the load class to null, it will locate resources using the class loader.
        Parameters:
        loadClass - the load class or null
    • Method Detail

      • resourceExists

        public boolean resourceExists​(String path)
        Description copied from interface: ResourceLocator
        Returns whether the specified resource exists.
        Specified by:
        resourceExists in interface ResourceLocator
        Parameters:
        path - the resource path
        Returns:
        true if the resource exists, false otherwise