Class PathPrefixerAvoidResolve
- Direct Known Subclasses:
DirectoryStructure
,FromDescriptiveName
,IfIncrementingNumberRequested
,IncrementingNumber
,LastDirectoryAsPrefix
,PathRegEx
This is useful for combining with the MultiRootedFilePathPrefixer. This results in relative-paths keeping the same root, as when passed in.
- Author:
- Owen Feehan
-
Constructor Summary
ConstructorsModifierConstructorDescriptionprotected
PathPrefixerAvoidResolve
(String prefix) Creates with a prefix. -
Method Summary
Modifier and TypeMethodDescriptionA string prefixed to each output-path.outFilePrefix
(NamedPath path, Optional<String> experimentIdentifier, PathPrefixerContext context) Provides a prefix which can be prepended to all output files.outFilePrefixAvoidResolve
(NamedPath path, Optional<String> experimentIdentifier, PathPrefixerContext context) Provides a prefix which can be prepended to all output files.abstract DirectoryWithPrefix
outFilePrefixFromPath
(NamedPath path, Path root, PathPrefixerContext context) Determines the out-file prefix from a path.rootDirectoryPrefix
(Optional<String> experimentIdentifier, PathPrefixerContext context) Provides a prefix that becomes the root-folder.rootDirectoryPrefixAvoidResolve
(Optional<String> experimentIdentifier) Provides a prefix that becomes the root-folder.void
A string prefixed to each output-path.Methods inherited from class org.anchoranalysis.io.output.bean.path.prefixer.PathPrefixer
resolvePath, resolvePath
Methods inherited from class org.anchoranalysis.bean.AnchorBean
checkMisconfigured, describeBean, describeChildren, duplicateBean, fields, findFieldsOfClass, getBeanName, getLocalPath, localise, toString
-
Constructor Details
-
PathPrefixerAvoidResolve
Creates with a prefix.- Parameters:
prefix
- a string prefixed to each output-path (see property description).
-
PathPrefixerAvoidResolve
public PathPrefixerAvoidResolve()
-
-
Method Details
-
rootDirectoryPrefix
public DirectoryWithPrefix rootDirectoryPrefix(Optional<String> experimentIdentifier, PathPrefixerContext context) throws PathPrefixerException Description copied from class:PathPrefixer
Provides a prefix that becomes the root-folder. The prefix should be an absolute path.- Specified by:
rootDirectoryPrefix
in classPathPrefixer
- 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.
-
outFilePrefix
public DirectoryWithPrefix outFilePrefix(NamedPath path, Optional<String> experimentIdentifier, PathPrefixerContext context) throws PathPrefixerException Description copied from class:PathPrefixer
Provides a prefix which can be prepended to all output files. The prefix should be an absolute path.- Specified by:
outFilePrefix
in classPathPrefixer
- 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.
-
rootDirectoryPrefixAvoidResolve
Provides a prefix that becomes the root-folder. It avoids resolving relative-paths.This is an alternative method to rootDirectoryPrefix that avoids resolving the out-path prefix against the file system
- Parameters:
experimentIdentifier
- if defined, an identifier for the experiment, to be included in the directory root.- Returns:
- a prefixer
-
outFilePrefixAvoidResolve
public DirectoryWithPrefix outFilePrefixAvoidResolve(NamedPath path, Optional<String> experimentIdentifier, PathPrefixerContext context) throws PathPrefixerException Provides a prefix which can be prepended to all output files. It avoids resolving relative-paths.- Parameters:
path
- an input-path to match againstexperimentIdentifier
- if defined, an identifier for the experiment, to be included in the directory root.context
- the path-prefixer context.- Returns:
- a prefixer.
- Throws:
PathPrefixerException
- if a prefix cannot be successfully derived.
-
outFilePrefixFromPath
public abstract DirectoryWithPrefix outFilePrefixFromPath(NamedPath path, Path root, PathPrefixerContext context) throws PathPrefixerException Determines the out-file prefix from a path.- Parameters:
path
- path to calculate prefix from with associated descriptive-nameroot
- root of prefixcontext
- the path-prefixer context.- Returns:
- folder/filename for prefixing.
- Throws:
PathPrefixerException
- if a prefix cannot be successfully derived.
-
getPrefix
A string prefixed to each output-path.This is typically a directory which to output the experiment-directory and files, but it may also be a combination of a directory and a file-name prefix.
If empty, first the bean will try to use any output-directory set in the input context if it exists, or otherwise use the system temp directory.
-
setPrefix
A string prefixed to each output-path.This is typically a directory which to output the experiment-directory and files, but it may also be a combination of a directory and a file-name prefix.
If empty, first the bean will try to use any output-directory set in the input context if it exists, or otherwise use the system temp directory.
-