public class DefaultExecutionContext extends Object implements ExecutionContext
| Modifier and Type | Field and Description |
|---|---|
static ExecutionContextFactory |
FACTORY
Factory returning a new instance of
DefaultExecutionContext using
the default constructor. |
| Constructor and Description |
|---|
DefaultExecutionContext() |
DefaultExecutionContext(File currentDirectory) |
| Modifier and Type | Method and Description |
|---|---|
ConverterRegistry |
getConverterRegistry() |
File |
getCurrentDirectory()
Returns the current directory, never null.
|
Map<String,String> |
getEnv() |
Locale |
getLocale() |
File |
getRelativeToCurrentDirectory(File file)
Returns the given file but relative to the
current directory if the given file path is not absolute. |
Properties |
getSys() |
File |
getTempDirectory() |
String |
getUser()
Returns the user name, usually defined by the
"user.name" system
property. |
File |
getUserHome()
Returns the user home directory, usually defined by the
"user.home" system property. |
<V> ValueConverter<V> |
getValueConverterFor(Class<V> type) |
VariableContext |
getVariableContext() |
void |
setCurrentDirectory(File currentDirectory) |
void |
setCurrentDirectory(String currentDirectory) |
void |
setLocale(Locale locale) |
public static final ExecutionContextFactory FACTORY
DefaultExecutionContext using
the default constructor.public DefaultExecutionContext()
public DefaultExecutionContext(File currentDirectory)
public void setCurrentDirectory(File currentDirectory)
public void setCurrentDirectory(String currentDirectory)
public File getRelativeToCurrentDirectory(File file)
ExecutionContextcurrent directory if the given file path is not absolute. Most commands
should resolve files through this method since the unix4j current
directory and the Java current directory are not the same.getRelativeToCurrentDirectory in interface ExecutionContextfile - the file to return relative to the current directory if it
denotes a relative pathcurrent directorypublic File getCurrentDirectory()
ExecutionContext"user.dir"
system property is returned.getCurrentDirectory in interface ExecutionContext"user.dir" system
property it has not been set explicitlySystem.getProperties()public String getUser()
ExecutionContext"user.name" system
property.getUser in interface ExecutionContext"user.name" system
propertySystem.getProperties()public File getUserHome()
ExecutionContext"user.home" system property.getUserHome in interface ExecutionContext"user.home" system propertySystem.getProperties()public File getTempDirectory()
getTempDirectory in interface ExecutionContextpublic Locale getLocale()
getLocale in interface ExecutionContextpublic Properties getSys()
getSys in interface ExecutionContextpublic VariableContext getVariableContext()
getVariableContext in interface ExecutionContextpublic ConverterRegistry getConverterRegistry()
getConverterRegistry in interface ExecutionContextpublic <V> ValueConverter<V> getValueConverterFor(Class<V> type)
getValueConverterFor in interface ExecutionContextCopyright © 2025. All rights reserved.