org.esa.beam.framework.param
Class AbstractParamValidator

java.lang.Object
  extended by org.esa.beam.framework.param.AbstractParamValidator
All Implemented Interfaces:
ParamValidator
Direct Known Subclasses:
BooleanValidator, ColorValidator, DateValidator, 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$
Author:
Norman Fomferra
See Also:
ParamValidator

Field Summary
protected  Logger _logger
           
 
Constructor Summary
protected AbstractParamValidator()
           
 
Method Summary
 boolean equalValues(Parameter parameter, Object value1, Object value2)
          Tests if the given two values are equal taking the given parameter information into account.
protected static boolean isAllowedNullText(Parameter parameter, String text)
          Tests if the given text is an allowed zero-length text string for the given parameter.
protected static boolean isAllowedNullValue(Parameter parameter, Object value)
          Tests if the given object is an allowed null value for the given parameter.
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.
protected  void validateThatNullValueIsAllowed(Parameter parameter, Object value)
          Tests if the value passed in is null, and if so, if this is an allowed value defined by the parameter.
protected  void validateThatValueIsInValueSet(Parameter parameter, Object value)
          Checks if a value object is contained in the valueset defined by the parameter.
protected  void validateThatValuesAreInValueSet(Parameter parameter, Object[] values)
          Checks if a vector of value objects is contained in the valueset defined bay the parameter.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface org.esa.beam.framework.param.ParamValidator
format, parse, validate
 

Field Detail

_logger

protected Logger _logger
Constructor Detail

AbstractParamValidator

protected AbstractParamValidator()
Method Detail

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


Copyright © 2002-2013 Brockmann Consult GmbH. All Rights Reserved.