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
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 Summary
Fields -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionbooleanequalValues(Parameter parameter, Object value1, Object value2) Tests if the given two values are equal taking the given parameter information into account.protected static booleanisAllowedNullText(Parameter parameter, String text) Tests if the given text is an allowed zero-length text string for the given parameter.protected static booleanisAllowedNullValue(Parameter parameter, Object value) Tests if the given object is an allowed null value for the given parameter.protected booleanisValueContainedInValueSet(Parameter parameter, Object value) Tests if the value passed in is containe in the value set defined by the Parameter passed as argument.protected voidvalidateThatNullValueIsAllowed(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 voidvalidateThatValueIsInValueSet(Parameter parameter, Object value) Checks if a value object is contained in the valueset defined by the parameter.protected voidvalidateThatValuesAreInValueSet(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, waitMethods inherited from interface org.esa.snap.core.param.ParamValidator
format, parse, validate
-
Field Details
-
_logger
-
-
Constructor Details
-
AbstractParamValidator
protected AbstractParamValidator()
-
-
Method Details
-
equalValues
Description copied from interface:ParamValidatorTests if the given two values are equal taking the given parameter information into account.- Specified by:
equalValuesin interfaceParamValidator- Parameters:
parameter- the parameter, must not benullvalue1- the first value, can benullvalue2- the second value, can also benull- Returns:
trueif the value are equal,falseotherwise
-
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
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
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:
trueif so
-
isAllowedNullValue
Tests if the given object is an allowed null value for the given parameter.- Parameters:
parameter- the parametervalue- the value to test- Returns:
trueif so
-