Class MovAvgModel.AbstractModelParser

  • Enclosing class:
    MovAvgModel

    public abstract static class MovAvgModel.AbstractModelParser
    extends java.lang.Object
    Abstract class which also provides some concrete parsing functionality.
    • Method Summary

      Modifier and Type Method Description
      protected void checkUnrecognizedParams​(java.util.Map<java.lang.String,​java.lang.Object> settings)  
      abstract MovAvgModel parse​(java.util.Map<java.lang.String,​java.lang.Object> settings, java.lang.String pipelineName, int windowSize)
      Parse a settings hash that is specific to this model
      protected boolean parseBoolParam​(java.util.Map<java.lang.String,​java.lang.Object> settings, java.lang.String name, boolean defaultValue)
      Extracts a boolean from the settings map, otherwise throws an exception
      protected double parseDoubleParam​(java.util.Map<java.lang.String,​java.lang.Object> settings, java.lang.String name, double defaultValue)
      Extracts a 0-1 inclusive double from the settings map, otherwise throws an exception
      protected int parseIntegerParam​(java.util.Map<java.lang.String,​java.lang.Object> settings, java.lang.String name, int defaultValue)
      Extracts an integer from the settings map, otherwise throws an exception
      • Methods inherited from class java.lang.Object

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

      • AbstractModelParser

        public AbstractModelParser()
    • Method Detail

      • parse

        public abstract MovAvgModel parse​(@Nullable
                                          java.util.Map<java.lang.String,​java.lang.Object> settings,
                                          java.lang.String pipelineName,
                                          int windowSize)
                                   throws java.text.ParseException
        Parse a settings hash that is specific to this model
        Parameters:
        settings - Map of settings, extracted from the request
        pipelineName - Name of the parent pipeline agg
        windowSize - Size of the window for this moving avg
        Returns:
        A fully built moving average model
        Throws:
        java.text.ParseException
      • parseDoubleParam

        protected double parseDoubleParam​(@Nullable
                                          java.util.Map<java.lang.String,​java.lang.Object> settings,
                                          java.lang.String name,
                                          double defaultValue)
                                   throws java.text.ParseException
        Extracts a 0-1 inclusive double from the settings map, otherwise throws an exception
        Parameters:
        settings - Map of settings provided to this model
        name - Name of parameter we are attempting to extract
        defaultValue - Default value to be used if value does not exist in map
        Returns:
        Double value extracted from settings map
        Throws:
        java.text.ParseException
      • parseIntegerParam

        protected int parseIntegerParam​(@Nullable
                                        java.util.Map<java.lang.String,​java.lang.Object> settings,
                                        java.lang.String name,
                                        int defaultValue)
                                 throws java.text.ParseException
        Extracts an integer from the settings map, otherwise throws an exception
        Parameters:
        settings - Map of settings provided to this model
        name - Name of parameter we are attempting to extract
        defaultValue - Default value to be used if value does not exist in map
        Returns:
        Integer value extracted from settings map
        Throws:
        java.text.ParseException
      • parseBoolParam

        protected boolean parseBoolParam​(@Nullable
                                         java.util.Map<java.lang.String,​java.lang.Object> settings,
                                         java.lang.String name,
                                         boolean defaultValue)
                                  throws java.text.ParseException
        Extracts a boolean from the settings map, otherwise throws an exception
        Parameters:
        settings - Map of settings provided to this model
        name - Name of parameter we are attempting to extract
        defaultValue - Default value to be used if value does not exist in map
        Returns:
        Boolean value extracted from settings map
        Throws:
        java.text.ParseException
      • checkUnrecognizedParams

        protected void checkUnrecognizedParams​(@Nullable
                                               java.util.Map<java.lang.String,​java.lang.Object> settings)
                                        throws java.text.ParseException
        Throws:
        java.text.ParseException