Class ResourcesHelper


  • public class ResourcesHelper
    extends Object
    Some useful methods to locate resources.

    Created on 08/04/16.

    Since:
    3.0
    Author:
    Tony Chemit - dev@tchemit.fr
    • Field Detail

      • outputDirectory

        protected final File outputDirectory
      • verbose

        protected final boolean verbose
    • Constructor Detail

      • ResourcesHelper

        public ResourcesHelper​(ClassLoader classLoader,
                               File outputDirectory,
                               boolean verbose)
    • Method Detail

      • isJavaFileInOutputDirectory

        public boolean isJavaFileInOutputDirectory​(String fqn)
        Checks if the given fully qualified name java file is in output directory.

        Send a log a message if found.

        Parameters:
        fqn - fully qualified name to test
        Returns:
        true if java file was found in output directory, false otherwise.
      • isJavaFileInClassPath

        public boolean isJavaFileInClassPath​(String fqn)
        Checks if the given fully qualified name java file (or class) is in class-path.

        Send a log a message if found.

        Parameters:
        fqn - fully qualified name to test
        Returns:
        true if java file was found in class-path, false otherwise.
      • isFullyQualifiedNameInClassPath

        public boolean isFullyQualifiedNameInClassPath​(String fqn,
                                                       String extension)
        Checks if the given fully qualified name (path separated by pathSeparator and optionally suffixed by extension) (and class if extension is .java) is in class-path.

        Send a log a message if found.

        Parameters:
        extension - file extension
        fqn - fully qualified name to test
        Returns:
        true if resource was found in class-path, false otherwise.
      • isInClassPath

        public boolean isInClassPath​(String fqn,
                                     String pathSeparator,
                                     String extension)
        Checks if the given fully qualified name (path separated by pathSeparator and optionally suffixed by extension) (and class if extension is .java) is in class-path.

        Send a log a message if found.

        Parameters:
        extension - file extension
        fqn - fully qualified name to test
        Returns:
        true if resource was found in class-path, false otherwise.
      • getFileInClassPath

        protected URL getFileInClassPath​(String fqn,
                                         String pathSeparator,
                                         String extension)
      • getFileInOutputDirectory

        protected URL getFileInOutputDirectory​(String fqn,
                                               String pathSeparator,
                                               String extension)