Class PathPrefixer
- Direct Known Subclasses:
HomeSubdirectory
,PathPrefixerAvoidResolve
,Rooted
Base classes for methods to determine an output directory and associated file prefix.
This is derived from an identifier for an experiment, and input paths.
- Author:
- Owen Feehan
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionabstract DirectoryWithPrefix
outFilePrefix
(NamedPath path, Optional<String> experimentIdentifier, PathPrefixerContext context) Provides a prefix which can be prepended to all output files.protected Path
resolvePath
(String pathToResolve) LikeresolvePath(Path)
but accepts a String as the path.protected Path
resolvePath
(Path pathToResolve) Converts a relative-path to an absolute-path (relative to the file-path associated with this current bean)abstract DirectoryWithPrefix
rootDirectoryPrefix
(Optional<String> experimentIdentifier, PathPrefixerContext context) Provides a prefix that becomes the root-folder.Methods inherited from class org.anchoranalysis.bean.AnchorBean
checkMisconfigured, describeBean, describeChildren, duplicateBean, fields, findFieldsOfClass, getBeanName, getLocalPath, localise, toString
-
Constructor Details
-
PathPrefixer
public PathPrefixer()
-
-
Method Details
-
outFilePrefix
public abstract DirectoryWithPrefix outFilePrefix(NamedPath path, Optional<String> experimentIdentifier, PathPrefixerContext context) throws PathPrefixerException Provides a prefix which can be prepended to all output files. The prefix should be an absolute path.- Parameters:
path
- an input to derive a prefix fromexperimentIdentifier
- if defined, an identifier for the experiment, to be included in the directory root.context
- the context in which prefixing of paths occurs.- Returns:
- a directory with an associated prefix.
- Throws:
PathPrefixerException
- if unable to successfully determine a prefix.
-
rootDirectoryPrefix
public abstract DirectoryWithPrefix rootDirectoryPrefix(Optional<String> experimentIdentifier, PathPrefixerContext context) throws PathPrefixerException Provides a prefix that becomes the root-folder. The prefix should be an absolute path.- Parameters:
experimentIdentifier
- if defined, an identifier for the experiment, to be included in the directory root.context
- the context in which prefixing of paths occurs.- Returns:
- a directory with an associated prefix.
- Throws:
PathPrefixerException
- if unable to successfully determine a prefix.
-
resolvePath
LikeresolvePath(Path)
but accepts a String as the path.- Parameters:
pathToResolve
- input-path that is relative.- Returns:
- the converted path (relative to the localizedPath of the current file)
-
resolvePath
Converts a relative-path to an absolute-path (relative to the file-path associated with this current bean)If there is no file-path associated with the current bean, then we throw an error if it is a relative path, or otherwise it remains unchanged
If the pathToResolve is already absolute, then we return it as-is
- Parameters:
pathToResolve
- input-path that is relative.- Returns:
- the converted path (relative to the localizedPath of the current file)
-