Interface ParamValidator

    • Method Summary

      All Methods Instance Methods Abstract Methods 
      Modifier and Type Method Description
      boolean equalValues​(Parameter parameter, Object value1, Object value2)
      Tests if the given two values are equal taking the given parameter information into account.
      String format​(Parameter parameter, Object value)
      Converts the given value into a text taking the given parameter information into account.
      Object parse​(Parameter parameter, String text)
      Converts the given text into a value taking the given parameter information into account.
      void validate​(Parameter parameter, Object value)
      Tests if the given value passes all constraints given in the supplied parameter information.
    • Method Detail

      • parse

        Object parse​(Parameter parameter,
                     String text)
              throws ParamParseException
        Converts the given text into a value taking the given parameter information into account.
        Parameters:
        parameter - the parameter, must not be null
        text - the text to be converted into a value, must not be null
        Returns:
        the value represented by the text
        Throws:
        ParamParseException
      • format

        String format​(Parameter parameter,
                      Object value)
               throws ParamFormatException
        Converts the given value into a text taking the given parameter information into account.
        Parameters:
        parameter - the parameter, must not be null
        value - the value to be converted into a text, can be null
        Returns:
        the value represented by the text, never null.
        Throws:
        ParamFormatException
      • validate

        void validate​(Parameter parameter,
                      Object value)
               throws ParamValidateException
        Tests if the given value passes all constraints given in the supplied parameter information. The value can also be null since parameters can be allowed to have the value 'null'.
        Parameters:
        parameter - the parameter, must not be null
        value - the value to be tested, can be null
        Throws:
        ParamValidateException
      • equalValues

        boolean equalValues​(Parameter parameter,
                            Object value1,
                            Object value2)
        Tests if the given two values are equal taking the given parameter information into account.
        Parameters:
        parameter - the parameter, must not be null
        value1 - the first value, can be null
        value2 - the second value, can also be null
        Returns:
        true if the value are equal, false otherwise