Class MetricConfig
- java.lang.Object
-
- java.util.Dictionary<K,V>
-
- java.util.Hashtable<Object,Object>
-
- java.util.Properties
-
- org.apache.flink.metrics.MetricConfig
-
- All Implemented Interfaces:
Serializable,Cloneable,Map<Object,Object>
@Public public class MetricConfig extends Properties
A properties class with added utility methods to extract primitives.Values may be stored as strings via
Properties.setProperty(String, String)or as native Java types viaProperties.put(Object, Object)(e.g., when Flink's YAML configuration parser stores Integer, Long, or Boolean values directly). The getter methods handle both representations transparently.- See Also:
- Serialized Form
-
-
Field Summary
-
Fields inherited from class java.util.Properties
defaults
-
-
Constructor Summary
Constructors Constructor Description MetricConfig()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description booleangetBoolean(String key, boolean defaultValue)Returns the value associated with the given key as aboolean.doublegetDouble(String key, double defaultValue)Returns the value associated with the given key as adouble.floatgetFloat(String key, float defaultValue)Returns the value associated with the given key as afloat.intgetInteger(String key, int defaultValue)Returns the value associated with the given key as anint.longgetLong(String key, long defaultValue)Returns the value associated with the given key as along.StringgetString(String key, String defaultValue)Returns the value associated with the given key as aString.-
Methods inherited from class java.util.Properties
clear, clone, compute, computeIfAbsent, computeIfPresent, contains, containsKey, containsValue, elements, entrySet, equals, forEach, get, getOrDefault, getProperty, getProperty, hashCode, isEmpty, keys, keySet, list, list, load, load, loadFromXML, merge, propertyNames, put, putAll, putIfAbsent, rehash, remove, remove, replace, replace, replaceAll, save, setProperty, size, store, store, storeToXML, storeToXML, storeToXML, stringPropertyNames, toString, values
-
-
-
-
Method Detail
-
getString
public String getString(String key, String defaultValue)
Returns the value associated with the given key as aString.If the value is not a
String, itstoString()representation is returned.- Parameters:
key- the hashtable key.defaultValue- a default value.- Returns:
- the value in this property list with the specified key value as a String.
-
getInteger
public int getInteger(String key, int defaultValue)
Returns the value associated with the given key as anint.If the value is a
Number, itsintValue()is returned directly. Otherwise, the value's string representation is parsed viaInteger.parseInt(String).- Parameters:
key- the hashtable key.defaultValue- a default value.- Returns:
- the value in this property list with the specified key value as an int.
-
getLong
public long getLong(String key, long defaultValue)
Returns the value associated with the given key as along.If the value is a
Number, itslongValue()is returned directly. Otherwise, the value's string representation is parsed viaLong.parseLong(String).- Parameters:
key- the hashtable key.defaultValue- a default value.- Returns:
- the value in this property list with the specified key value as a long.
-
getFloat
public float getFloat(String key, float defaultValue)
Returns the value associated with the given key as afloat.If the value is a
Number, itsfloatValue()is returned directly. Otherwise, the value's string representation is parsed viaFloat.parseFloat(String).- Parameters:
key- the hashtable key.defaultValue- a default value.- Returns:
- the value in this property list with the specified key value as a float.
-
getDouble
public double getDouble(String key, double defaultValue)
Returns the value associated with the given key as adouble.If the value is a
Number, itsdoubleValue()is returned directly. Otherwise, the value's string representation is parsed viaDouble.parseDouble(String).- Parameters:
key- the hashtable key.defaultValue- a default value.- Returns:
- the value in this property list with the specified key value as a double.
-
getBoolean
public boolean getBoolean(String key, boolean defaultValue)
Returns the value associated with the given key as aboolean.If the value is a
Boolean, it is returned directly. Otherwise, the value's string representation is parsed viaBoolean.parseBoolean(String).- Parameters:
key- the hashtable key.defaultValue- a default value.- Returns:
- the value in this property list with the specified key value as a boolean.
-
-