public class BaseDir
extends util.object.Wrapper<java.nio.file.Path>
resolving
paths in configuration files.
The base directory path will be set to:
0; otherwise
0;
otherwise| Constructor and Description |
|---|
BaseDir(java.lang.String sysPropKey,
java.lang.String envVarName)
Creates a new instance using the path returned by the
lookup method. |
| Modifier and Type | Method and Description |
|---|---|
static java.nio.file.Path |
lookup(java.lang.String key,
java.lang.String varName)
Looks up the path associated to the specified key in the system
properties.
|
java.nio.file.Path |
resolve(java.lang.String configuredPath)
Resolves the given path as follows.
|
java.nio.file.Path |
resolveRequiredPath(java.lang.String configuredPath)
Resolves the given path as follows.
|
static void |
store(java.lang.String key,
java.nio.file.Path dir)
Sets a system property with the specified key and value.
|
static java.nio.file.Path |
storeTempDir(java.lang.String key,
java.lang.String dirNamePrefix)
Creates a temporary directory and sets its path in the system properties
using the given key.
|
public BaseDir(java.lang.String sysPropKey,
java.lang.String envVarName)
lookup method.public static java.nio.file.Path lookup(java.lang.String key,
java.lang.String varName)
key - the system property key.varName - the name of the environment variable.java.lang.IllegalArgumentException - if any argument is null or
empty.public static void store(java.lang.String key,
java.nio.file.Path dir)
key - the key.dir - the value.java.lang.IllegalArgumentException - if the key is null or empty.java.lang.NullPointerException - if dir is null.public static java.nio.file.Path storeTempDir(java.lang.String key,
java.lang.String dirNamePrefix)
throws java.io.IOException
key - the system property key.dirNamePrefix - name prefix of the temporary directory to create.java.io.IOException - if the directory could not be created.java.lang.IllegalArgumentException - if any argument is null or
empty.public java.nio.file.Path resolve(java.lang.String configuredPath)
null or empty, this base directory is
returned.configuredPath - a path in a configuration file.public java.nio.file.Path resolveRequiredPath(java.lang.String configuredPath)
configuredPath - a path in a configuration file.java.lang.IllegalArgumentException - if the argument is null or
empty.