Class AbstractParamValidator

java.lang.Object
org.esa.snap.core.param.AbstractParamValidator
All Implemented Interfaces:
ParamValidator
Direct Known Subclasses:
BooleanValidator, ColorValidator, FileValidator, NumberValidator, StringArrayValidator, StringValidator

public abstract class AbstractParamValidator extends Object implements ParamValidator
The AbstractParamValidator acts as a base class for implementations of ParamValidator interface by providing some default method implementations and several utility methods for common validators.
Version:
$Revision$ $Date$
See Also:
  • Field Details

    • _logger

      protected Logger _logger
  • Constructor Details

    • AbstractParamValidator

      protected AbstractParamValidator()
  • Method Details

    • equalValues

      public boolean equalValues(Parameter parameter, Object value1, Object value2)
      Description copied from interface: ParamValidator
      Tests if the given two values are equal taking the given parameter information into account.
      Specified by:
      equalValues in interface ParamValidator
      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
    • validateThatNullValueIsAllowed

      protected void validateThatNullValueIsAllowed(Parameter parameter, Object value) throws ParamValidateException
      Tests if the value passed in is null, and if so, if this is an allowed value defined by the parameter. When this is not the case, the errorhandle passed in is invoked.
      Parameters:
      parameter - the Parameter defining the null value behaviour
      value - the value to be checked
      Throws:
      ParamValidateException
    • validateThatValuesAreInValueSet

      protected void validateThatValuesAreInValueSet(Parameter parameter, Object[] values) throws ParamValidateException
      Checks if a vector of value objects is contained in the valueset defined bay the parameter. If not, the error handler passed in is invoked.
      Parameters:
      parameter - the Parameter defining the valueset
      values - vector of objects to be checked
      Throws:
      ParamValidateException
    • validateThatValueIsInValueSet

      protected void validateThatValueIsInValueSet(Parameter parameter, Object value) throws ParamValidateException
      Checks if a value object is contained in the valueset defined by the parameter. If not, the error handler passed in is invoked.
      Parameters:
      parameter - the Parameter defining the valueset
      value - object to be checked
      Throws:
      ParamValidateException
    • isValueContainedInValueSet

      protected boolean isValueContainedInValueSet(Parameter parameter, Object value)
      Tests if the value passed in is containe in the value set defined by the Parameter passed as argument.
      Parameters:
      parameter - the parameter whose value set is to be checked
      value - the value to be checked
    • isAllowedNullText

      protected static boolean isAllowedNullText(Parameter parameter, String text)
      Tests if the given text is an allowed zero-length text string for the given parameter.
      Parameters:
      parameter - the parameter
      text - the text to test
      Returns:
      true if so
    • isAllowedNullValue

      protected static boolean isAllowedNullValue(Parameter parameter, Object value)
      Tests if the given object is an allowed null value for the given parameter.
      Parameters:
      parameter - the parameter
      value - the value to test
      Returns:
      true if so