Package org.esa.snap.core.param
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
TheAbstractParamValidator
acts as a base class for implementations ofParamValidator
interface by providing some default method implementations and several utility methods for common validators.- Version:
- $Revision$ $Date$
- See Also:
ParamValidator
-
-
Constructor Summary
Constructors Modifier Constructor Description protected
AbstractParamValidator()
-
Method Summary
All Methods Static Methods Instance Methods Concrete 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.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.snap.core.param.ParamValidator
format, parse, validate
-
-
-
-
Field Detail
-
_logger
protected Logger _logger
-
-
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 interfaceParamValidator
- Parameters:
parameter
- the parameter, must not benull
value1
- the first value, can benull
value2
- the second value, can also benull
- 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 behaviourvalue
- 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 valuesetvalues
- 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 valuesetvalue
- 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 checkedvalue
- 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 parametertext
- the text to test- Returns:
true
if so
-
-