Package org.nuiton.eugene
Class ResourcesHelper
- java.lang.Object
-
- org.nuiton.eugene.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 Summary
Fields Modifier and Type Field Description protected ClassLoaderclassLoaderprotected FileoutputDirectoryprotected booleanverbose
-
Constructor Summary
Constructors Constructor Description ResourcesHelper(ClassLoader classLoader, File outputDirectory, boolean verbose)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description protected URLgetFileInClassPath(String fqn, String pathSeparator, String extension)protected URLgetFileInOutputDirectory(String fqn, String pathSeparator, String extension)booleanisFullyQualifiedNameInClassPath(String fqn, String extension)Checks if the given fully qualified name (path separated bypathSeparatorand optionally suffixed byextension) (and class if extension is .java) is in class-path.booleanisInClassPath(String fqn, String pathSeparator, String extension)Checks if the given fully qualified name (path separated bypathSeparatorand optionally suffixed byextension) (and class if extension is.java) is in class-path.booleanisJavaFileInClassPath(String fqn)Checks if the given fully qualified name java file (or class) is in class-path.booleanisJavaFileInOutputDirectory(String fqn)Checks if the given fully qualified name java file is in output directory.
-
-
-
Field Detail
-
classLoader
protected final ClassLoader classLoader
-
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:
trueif java file was found in output directory,falseotherwise.
-
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:
trueif java file was found in class-path,falseotherwise.
-
isFullyQualifiedNameInClassPath
public boolean isFullyQualifiedNameInClassPath(String fqn, String extension)
Checks if the given fully qualified name (path separated bypathSeparatorand optionally suffixed byextension) (and class if extension is .java) is in class-path.Send a log a message if found.
- Parameters:
extension- file extensionfqn- fully qualified name to test- Returns:
trueif resource was found in class-path,falseotherwise.
-
isInClassPath
public boolean isInClassPath(String fqn, String pathSeparator, String extension)
Checks if the given fully qualified name (path separated bypathSeparatorand optionally suffixed byextension) (and class if extension is.java) is in class-path.Send a log a message if found.
- Parameters:
extension- file extensionfqn- fully qualified name to test- Returns:
trueif resource was found in class-path,falseotherwise.
-
getFileInClassPath
protected URL getFileInClassPath(String fqn, String pathSeparator, String extension)
-
-