Class 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 to FetchResults 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 the fetchResults with NaN values for all sources which do not have values in the fetchResults.
      static java.lang.Double toDouble​(java.lang.Object o)
      Attempts to cast an arbitrary object to a Double.
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Constructor Detail

      • Utils

        public Utils()
    • 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 null
        java.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 to FetchResults 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 the ExpressionEngine.
      • fillMissingValues

        public static void fillMissingValues​(FetchResults fetchResults,
                                             java.util.List<Source> sources)
        Enrich the fetchResults with NaN values for all sources which do not have values in the fetchResults.
        Parameters:
        fetchResults -
        sources -
      • createEmtpyFetchResults

        public static FetchResults createEmtpyFetchResults​(long step,
                                                           java.util.Map<java.lang.String,​java.lang.Object> constants)