Package org.apache.flink.util
Class AbstractParameterTool
- java.lang.Object
-
- org.apache.flink.api.common.ExecutionConfig.GlobalJobParameters
-
- org.apache.flink.util.AbstractParameterTool
-
- All Implemented Interfaces:
Serializable
,Cloneable
- Direct Known Subclasses:
MultipleParameterTool
,ParameterTool
@Public public abstract class AbstractParameterTool extends ExecutionConfig.GlobalJobParameters implements Serializable, Cloneable
This class provides common utility methods ofParameterTool
andMultipleParameterTool
.- See Also:
- Serialized Form
-
-
Field Summary
Fields Modifier and Type Field Description protected static String
DEFAULT_UNDEFINED
protected Map<String,String>
defaultData
protected static String
NO_VALUE_KEY
protected Set<String>
unrequestedParameters
-
Constructor Summary
Constructors Constructor Description AbstractParameterTool()
-
Method Summary
All Methods Instance Methods Abstract Methods Concrete Methods Modifier and Type Method Description protected void
addToDefaults(String key, String value)
protected abstract Object
clone()
protected abstract String
get(String key)
Returns the String value for the given key.String
get(String key, String defaultValue)
Returns the String value for the given key.boolean
getBoolean(String key)
Returns the Boolean value for the given key.boolean
getBoolean(String key, boolean defaultValue)
Returns the Boolean value for the given key.byte
getByte(String key)
Returns the Byte value for the given key.byte
getByte(String key, byte defaultValue)
Returns the Byte value for the given key.double
getDouble(String key)
Returns the Double value for the given key.double
getDouble(String key, double defaultValue)
Returns the Double value for the given key.float
getFloat(String key)
Returns the Float value for the given key.float
getFloat(String key, float defaultValue)
Returns the Float value for the given key.int
getInt(String key)
Returns the Integer value for the given key.int
getInt(String key, int defaultValue)
Returns the Integer value for the given key.long
getLong(String key)
Returns the Long value for the given key.long
getLong(String key, long defaultValue)
Returns the Long value for the given key.protected abstract int
getNumberOfParameters()
Returns number of parameters inAbstractParameterTool
.String
getRequired(String key)
Returns the String value for the given key.short
getShort(String key)
Returns the Short value for the given key.short
getShort(String key, short defaultValue)
Returns the Short value for the given key.Set<String>
getUnrequestedParameters()
Returns the set of parameter names which have not been requested withhas(String)
or one of theget
methods.abstract boolean
has(String value)
Check if value is set.abstract Map<String,String>
toMap()
Convert UserConfig into aMap<String, String>
representation.-
Methods inherited from class org.apache.flink.api.common.ExecutionConfig.GlobalJobParameters
equals, hashCode
-
-
-
-
Field Detail
-
NO_VALUE_KEY
protected static final String NO_VALUE_KEY
- See Also:
- Constant Field Values
-
DEFAULT_UNDEFINED
protected static final String DEFAULT_UNDEFINED
- See Also:
- Constant Field Values
-
-
Method Detail
-
getUnrequestedParameters
@PublicEvolving public Set<String> getUnrequestedParameters()
Returns the set of parameter names which have not been requested withhas(String)
or one of theget
methods. Access to the map returned bytoMap()
is not tracked.
-
getNumberOfParameters
protected abstract int getNumberOfParameters()
Returns number of parameters inAbstractParameterTool
.
-
get
protected abstract String get(String key)
Returns the String value for the given key. If the key does not exist it will return null.
-
has
public abstract boolean has(String value)
Check if value is set.
-
getRequired
public String getRequired(String key)
Returns the String value for the given key. If the key does not exist it will throw aRuntimeException
.
-
get
public String get(String key, String defaultValue)
Returns the String value for the given key. If the key does not exist it will return the given default value.
-
getInt
public int getInt(String key)
Returns the Integer value for the given key. The method fails if the key does not exist or the value is not an Integer.
-
getInt
public int getInt(String key, int defaultValue)
Returns the Integer value for the given key. If the key does not exists it will return the default value given. The method fails if the value is not an Integer.
-
getLong
public long getLong(String key)
Returns the Long value for the given key. The method fails if the key does not exist.
-
getLong
public long getLong(String key, long defaultValue)
Returns the Long value for the given key. If the key does not exists it will return the default value given. The method fails if the value is not a Long.
-
getFloat
public float getFloat(String key)
Returns the Float value for the given key. The method fails if the key does not exist.
-
getFloat
public float getFloat(String key, float defaultValue)
Returns the Float value for the given key. If the key does not exists it will return the default value given. The method fails if the value is not a Float.
-
getDouble
public double getDouble(String key)
Returns the Double value for the given key. The method fails if the key does not exist.
-
getDouble
public double getDouble(String key, double defaultValue)
Returns the Double value for the given key. If the key does not exists it will return the default value given. The method fails if the value is not a Double.
-
getBoolean
public boolean getBoolean(String key)
Returns the Boolean value for the given key. The method fails if the key does not exist.
-
getBoolean
public boolean getBoolean(String key, boolean defaultValue)
Returns the Boolean value for the given key. If the key does not exists it will return the default value given. The method returns whether the string of the value is "true" ignoring cases.
-
getShort
public short getShort(String key)
Returns the Short value for the given key. The method fails if the key does not exist.
-
getShort
public short getShort(String key, short defaultValue)
Returns the Short value for the given key. If the key does not exists it will return the default value given. The method fails if the value is not a Short.
-
getByte
public byte getByte(String key)
Returns the Byte value for the given key. The method fails if the key does not exist.
-
getByte
public byte getByte(String key, byte defaultValue)
Returns the Byte value for the given key. If the key does not exists it will return the default value given. The method fails if the value is not a Byte.
-
clone
protected abstract Object clone() throws CloneNotSupportedException
- Overrides:
clone
in classObject
- Throws:
CloneNotSupportedException
-
toMap
public abstract Map<String,String> toMap()
Description copied from class:ExecutionConfig.GlobalJobParameters
Convert UserConfig into aMap<String, String>
representation. This can be used by the runtime, for example for presenting the user config in the web frontend.- Overrides:
toMap
in classExecutionConfig.GlobalJobParameters
- Returns:
- Key/Value representation of the UserConfig
-
-