public class DerivedExecutionContext extends Object implements ExecutionContext
Constructor and Description |
---|
DerivedExecutionContext()
Constructor for new derived execution context with a new instance of
DefaultExecutionContext as delegate context. |
DerivedExecutionContext(ExecutionContext delegate)
Constructor for new derived execution context with the specified delegate
context.
|
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() |
protected void |
init()
Initialisation method called from the constructor.
|
void |
setConverterRegistry(ConverterRegistry converterRegistry) |
void |
setCurrentDirectory(File currentDirectory) |
void |
setCurrentDirectory(String currentDirectory) |
void |
setEnv(Map<String,String> env) |
void |
setLocale(Locale locale) |
void |
setSys(Properties sys) |
void |
setTempDirectory(File tempDirectory) |
void |
setTempDirectory(String tempDirectory) |
void |
setUser(String user) |
void |
setUserHome(File userHome) |
void |
setUserHome(String userHome) |
void |
setVariableContext(VariableContext variableContext) |
public DerivedExecutionContext()
DefaultExecutionContext
as delegate context.public DerivedExecutionContext(ExecutionContext delegate)
delegate
- the delegate context to which all getter calls are forwarded
by defaultprotected void init()
ExecutionContextVariableResolver
for this
derived context to the VariableContext
.getVariableContext()
public void setCurrentDirectory(File currentDirectory)
public void setCurrentDirectory(String currentDirectory)
public 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 File getRelativeToCurrentDirectory(File file)
ExecutionContext
current 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 ExecutionContext
file
- the file to return relative to the current directory if it
denotes a relative pathcurrent directory
public String getUser()
ExecutionContext
"user.name"
system
property.getUser
in interface ExecutionContext
"user.name"
system
propertySystem.getProperties()
public void setUserHome(File userHome)
public void setUserHome(String userHome)
public File getUserHome()
ExecutionContext
"user.home"
system property.getUserHome
in interface ExecutionContext
"user.home"
system propertySystem.getProperties()
public void setTempDirectory(File tempDirectory)
public void setTempDirectory(String tempDirectory)
public File getTempDirectory()
getTempDirectory
in interface ExecutionContext
public Locale getLocale()
getLocale
in interface ExecutionContext
public void setSys(Properties sys)
public Properties getSys()
getSys
in interface ExecutionContext
public void setVariableContext(VariableContext variableContext)
public VariableContext getVariableContext()
getVariableContext
in interface ExecutionContext
public void setConverterRegistry(ConverterRegistry converterRegistry)
public ConverterRegistry getConverterRegistry()
getConverterRegistry
in interface ExecutionContext
public <V> ValueConverter<V> getValueConverterFor(Class<V> type)
getValueConverterFor
in interface ExecutionContext
Copyright © 2024. All rights reserved.