From 627c81473c265cd2bad7780f3e976874d2023359 Mon Sep 17 00:00:00 2001 From: zentol Date: Wed, 10 Aug 2016 16:23:54 +0200 Subject: [PATCH] [FLINK-4302] [metrics] Add documentation to MetricConfig --- .../apache/flink/metrics/MetricConfig.java | 53 +++++++++++++++++++ .../metrics/reporter/MetricReporter.java | 2 +- 2 files changed, 54 insertions(+), 1 deletion(-) diff --git a/flink-metrics/flink-metrics-core/src/main/java/org/apache/flink/metrics/MetricConfig.java b/flink-metrics/flink-metrics-core/src/main/java/org/apache/flink/metrics/MetricConfig.java index a611ae86e42cc..4a2e616a3a37c 100644 --- a/flink-metrics/flink-metrics-core/src/main/java/org/apache/flink/metrics/MetricConfig.java +++ b/flink-metrics/flink-metrics-core/src/main/java/org/apache/flink/metrics/MetricConfig.java @@ -19,12 +19,25 @@ import java.util.Properties; +/** + * A properties class with added utility method to extract primitives. + */ public class MetricConfig extends Properties { public String getString(String key, String defaultValue) { return getProperty(key, defaultValue); } + /** + * Searches for the property with the specified key in this property list. + * If the key is not found in this property list, the default property list, + * and its defaults, recursively, are then checked. The method returns the + * default value argument if the property is not found. + * + * @param key the hashtable key. + * @param defaultValue a default value. + * @return the value in this property list with the specified key value parsed as an int. + */ public int getInteger(String key, int defaultValue) { String argument = getProperty(key, null); return argument == null @@ -32,6 +45,16 @@ public int getInteger(String key, int defaultValue) { : Integer.parseInt(argument); } + /** + * Searches for the property with the specified key in this property list. + * If the key is not found in this property list, the default property list, + * and its defaults, recursively, are then checked. The method returns the + * default value argument if the property is not found. + * + * @param key the hashtable key. + * @param defaultValue a default value. + * @return the value in this property list with the specified key value parsed as a long. + */ public long getLong(String key, long defaultValue) { String argument = getProperty(key, null); return argument == null @@ -39,6 +62,16 @@ public long getLong(String key, long defaultValue) { : Long.parseLong(argument); } + /** + * Searches for the property with the specified key in this property list. + * If the key is not found in this property list, the default property list, + * and its defaults, recursively, are then checked. The method returns the + * default value argument if the property is not found. + * + * @param key the hashtable key. + * @param defaultValue a default value. + * @return the value in this property list with the specified key value parsed as a float. + */ public float getFloat(String key, float defaultValue) { String argument = getProperty(key, null); return argument == null @@ -46,6 +79,16 @@ public float getFloat(String key, float defaultValue) { : Float.parseFloat(argument); } + /** + * Searches for the property with the specified key in this property list. + * If the key is not found in this property list, the default property list, + * and its defaults, recursively, are then checked. The method returns the + * default value argument if the property is not found. + * + * @param key the hashtable key. + * @param defaultValue a default value. + * @return the value in this property list with the specified key value parsed as a double. + */ public double getDouble(String key, double defaultValue) { String argument = getProperty(key, null); return argument == null @@ -53,6 +96,16 @@ public double getDouble(String key, double defaultValue) { : Double.parseDouble(argument); } + /** + * Searches for the property with the specified key in this property list. + * If the key is not found in this property list, the default property list, + * and its defaults, recursively, are then checked. The method returns the + * default value argument if the property is not found. + * + * @param key the hashtable key. + * @param defaultValue a default value. + * @return the value in this property list with the specified key value parsed as a boolean. + */ public boolean getBoolean(String key, boolean defaultValue) { String argument = getProperty(key, null); return argument == null diff --git a/flink-metrics/flink-metrics-core/src/main/java/org/apache/flink/metrics/reporter/MetricReporter.java b/flink-metrics/flink-metrics-core/src/main/java/org/apache/flink/metrics/reporter/MetricReporter.java index bd13be74cbfca..ee92a1057a9cd 100644 --- a/flink-metrics/flink-metrics-core/src/main/java/org/apache/flink/metrics/reporter/MetricReporter.java +++ b/flink-metrics/flink-metrics-core/src/main/java/org/apache/flink/metrics/reporter/MetricReporter.java @@ -40,7 +40,7 @@ public interface MetricReporter { * *

This method is always called first on a newly instantiated reporter. * - * @param config The configuration with all parameters. + * @param config A properties object that contains all parameters set for this reporter. */ void open(MetricConfig config);