Class Utils
- java.lang.Object
-
- org.opennms.netmgt.measurements.utils.Utils
-
public class Utils extends Object
Utility functions.- Author:
- jwhite
-
-
Constructor Summary
Constructors Constructor Description Utils()
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static voidconvertStringAttributesToConstants(String sourceLabel, Map<String,String> stringAttributes, Map<String,Object> fetchResultConstants)Converts constants stored in strings.properties toFetchResultsconstants.static FetchResultscreateEmtpyFetchResults(long step, Map<String,Object> constants)static voidfillMissingValues(FetchResults fetchResults, List<Source> sources)Enrich thefetchResultswith NaN values for allsourceswhich do not have values in thefetchResults.static DoubletoDouble(Object o)Attempts to cast an arbitrary object to a Double.
-
-
-
Method Detail
-
toDouble
public static Double toDouble(Object o)
Attempts to cast an arbitrary object to a Double.- Throws:
NullPointerException- when o is nullNumberFormatException- when the cast fails
-
convertStringAttributesToConstants
public static void convertStringAttributesToConstants(String sourceLabel, Map<String,String> stringAttributes, Map<String,Object> fetchResultConstants)
Converts constants stored in strings.properties toFetchResultsconstants. Keys are prefix with the source label in order to avoid collisions. Values are converted to doubles when possible to allows the to be used by theExpressionEngine.
-
fillMissingValues
public static void fillMissingValues(FetchResults fetchResults, List<Source> sources)
Enrich thefetchResultswith NaN values for allsourceswhich do not have values in thefetchResults.- Parameters:
fetchResults-sources-
-
createEmtpyFetchResults
public static FetchResults createEmtpyFetchResults(long step, Map<String,Object> constants)
-
-