@Public public class ParameterTool extends AbstractParameterTool
Modifier and Type | Field and Description |
---|---|
protected Map<String,String> |
data |
DEFAULT_UNDEFINED, defaultData, NO_VALUE_KEY, unrequestedParameters
Modifier and Type | Method and Description |
---|---|
protected Object |
clone() |
void |
createPropertiesFile(String pathToFile)
Create a properties file with all the known parameters (call after the last get*() call).
|
void |
createPropertiesFile(String pathToFile,
boolean overwrite)
Create a properties file with all the known parameters (call after the last get*() call).
|
boolean |
equals(Object o) |
static ParameterTool |
fromArgs(String[] args)
Returns
ParameterTool for the given arguments. |
static ParameterTool |
fromMap(Map<String,String> map)
Returns
ParameterTool for the given map. |
static ParameterTool |
fromPropertiesFile(File file)
Returns
ParameterTool for the given Properties file. |
static ParameterTool |
fromPropertiesFile(InputStream inputStream)
Returns
ParameterTool for the given InputStream from Properties file. |
static ParameterTool |
fromPropertiesFile(String path)
Returns
ParameterTool for the given Properties file. |
static ParameterTool |
fromSystemProperties()
Returns
ParameterTool from the system properties. |
String |
get(String key)
Returns the String value for the given key.
|
Configuration |
getConfiguration()
Returns a
Configuration object from this ParameterTool . |
int |
getNumberOfParameters()
Returns number of parameters in
ParameterTool . |
Properties |
getProperties()
Returns a
Properties object from this ParameterTool . |
boolean |
has(String value)
Check if value is set.
|
int |
hashCode() |
ParameterTool |
mergeWith(ParameterTool other)
Merges two
ParameterTool . |
Map<String,String> |
toMap()
Convert UserConfig into a
Map<String, String> representation. |
addToDefaults, get, getBoolean, getBoolean, getByte, getByte, getDouble, getDouble, getFloat, getFloat, getInt, getInt, getLong, getLong, getRequired, getShort, getShort, getUnrequestedParameters
public static ParameterTool fromArgs(String[] args)
ParameterTool
for the given arguments. The arguments are keys followed by
values. Keys have to start with '-' or '--'
Example arguments: --key1 value1 --key2 value2 -key3 value3
args
- Input array argumentsParameterTool
public static ParameterTool fromPropertiesFile(String path) throws IOException
ParameterTool
for the given Properties
file.path
- Path to the properties fileParameterTool
IOException
- If the file does not existProperties
public static ParameterTool fromPropertiesFile(File file) throws IOException
ParameterTool
for the given Properties
file.file
- File object to the properties fileParameterTool
IOException
- If the file does not existProperties
public static ParameterTool fromPropertiesFile(InputStream inputStream) throws IOException
ParameterTool
for the given InputStream from Properties
file.inputStream
- InputStream from the properties fileParameterTool
IOException
- If the file does not existProperties
public static ParameterTool fromMap(Map<String,String> map)
ParameterTool
for the given map.map
- A map of arguments. Both Key and Value have to be StringsParameterTool
public static ParameterTool fromSystemProperties()
ParameterTool
from the system properties. Example on how to pass system
properties: -Dkey1=value1 -Dkey2=value2ParameterTool
public boolean equals(Object o)
equals
in class ExecutionConfig.GlobalJobParameters
public int hashCode()
hashCode
in class ExecutionConfig.GlobalJobParameters
public int getNumberOfParameters()
ParameterTool
.getNumberOfParameters
in class AbstractParameterTool
public String get(String key)
get
in class AbstractParameterTool
public boolean has(String value)
has
in class AbstractParameterTool
public Configuration getConfiguration()
Configuration
object from this ParameterTool
.Configuration
public Properties getProperties()
Properties
object from this ParameterTool
.Properties
public void createPropertiesFile(String pathToFile) throws IOException
Use this method to create a properties file skeleton.
pathToFile
- Location of the default properties file.IOException
public void createPropertiesFile(String pathToFile, boolean overwrite) throws IOException
pathToFile
- Location of the default properties file.overwrite
- Boolean flag indicating whether or not to overwrite the fileIOException
- If overwrite is not allowed and the file existsprotected Object clone() throws CloneNotSupportedException
clone
in class AbstractParameterTool
CloneNotSupportedException
public ParameterTool mergeWith(ParameterTool other)
ParameterTool
.other
- Other ParameterTool
objectParameterTool
public Map<String,String> toMap()
ExecutionConfig.GlobalJobParameters
Map<String, String>
representation. This can be used by
the runtime, for example for presenting the user config in the web frontend.toMap
in class AbstractParameterTool
Copyright © 2014–2024 The Apache Software Foundation. All rights reserved.