public class DefaultExecutionContext extends java.lang.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(java.io.File currentDirectory) |
| Modifier and Type | Method and Description |
|---|---|
ConverterRegistry |
getConverterRegistry() |
java.io.File |
getCurrentDirectory()
Returns the current directory, never null.
|
java.util.Map<java.lang.String,java.lang.String> |
getEnv() |
java.util.Locale |
getLocale() |
java.io.File |
getRelativeToCurrentDirectory(java.io.File file)
Returns the given file but relative to the
current directory if the given file path is not absolute. |
java.util.Properties |
getSys() |
java.io.File |
getTempDirectory() |
java.lang.String |
getUser()
Returns the user name, usually defined by the
"user.name" system
property. |
java.io.File |
getUserHome()
Returns the user home directory, usually defined by the
"user.home" system property. |
<V> ValueConverter<V> |
getValueConverterFor(java.lang.Class<V> type) |
VariableContext |
getVariableContext() |
void |
setCurrentDirectory(java.io.File currentDirectory) |
void |
setCurrentDirectory(java.lang.String currentDirectory) |
void |
setLocale(java.util.Locale locale) |
public static final ExecutionContextFactory FACTORY
DefaultExecutionContext using
the default constructor.public DefaultExecutionContext()
public DefaultExecutionContext(java.io.File currentDirectory)
public void setCurrentDirectory(java.io.File currentDirectory)
public void setCurrentDirectory(java.lang.String currentDirectory)
public java.io.File getRelativeToCurrentDirectory(java.io.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 java.io.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 java.lang.String getUser()
ExecutionContext"user.name" system
property.getUser in interface ExecutionContext"user.name" system
propertySystem.getProperties()public java.io.File getUserHome()
ExecutionContext"user.home" system property.getUserHome in interface ExecutionContext"user.home" system propertySystem.getProperties()public java.io.File getTempDirectory()
getTempDirectory in interface ExecutionContextpublic void setLocale(java.util.Locale locale)
public java.util.Locale getLocale()
getLocale in interface ExecutionContextpublic java.util.Map<java.lang.String,java.lang.String> getEnv()
getEnv in interface ExecutionContextpublic java.util.Properties getSys()
getSys in interface ExecutionContextpublic VariableContext getVariableContext()
getVariableContext in interface ExecutionContextpublic ConverterRegistry getConverterRegistry()
getConverterRegistry in interface ExecutionContextpublic <V> ValueConverter<V> getValueConverterFor(java.lang.Class<V> type)
getValueConverterFor in interface ExecutionContextCopyright © 2021. All Rights Reserved.