Class Utils
- java.lang.Object
-
- org.opennms.netmgt.measurements.utils.Utils
-
public class Utils extends java.lang.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 void
convertStringAttributesToConstants(java.lang.String sourceLabel, java.util.Map<java.lang.String,java.lang.String> stringAttributes, java.util.Map<java.lang.String,java.lang.Object> fetchResultConstants)
Converts constants stored in strings.properties toFetchResults
constants.static FetchResults
createEmtpyFetchResults(long step, java.util.Map<java.lang.String,java.lang.Object> constants)
static void
fillMissingValues(FetchResults fetchResults, java.util.List<Source> sources)
Enrich thefetchResults
with NaN values for allsources
which do not have values in thefetchResults
.static java.lang.Double
toDouble(java.lang.Object o)
Attempts to cast an arbitrary object to a Double.
-
-
-
Method Detail
-
toDouble
public static java.lang.Double toDouble(java.lang.Object o)
Attempts to cast an arbitrary object to a Double.- Throws:
java.lang.NullPointerException
- when o is nulljava.lang.NumberFormatException
- when the cast fails
-
convertStringAttributesToConstants
public static void convertStringAttributesToConstants(java.lang.String sourceLabel, java.util.Map<java.lang.String,java.lang.String> stringAttributes, java.util.Map<java.lang.String,java.lang.Object> fetchResultConstants)
Converts constants stored in strings.properties toFetchResults
constants. 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, java.util.List<Source> sources)
Enrich thefetchResults
with NaN values for allsources
which do not have values in thefetchResults
.- Parameters:
fetchResults
-sources
-
-
createEmtpyFetchResults
public static FetchResults createEmtpyFetchResults(long step, java.util.Map<java.lang.String,java.lang.Object> constants)
-
-