Class StringValidator
java.lang.Object
org.esa.snap.core.param.AbstractParamValidator
org.esa.snap.core.param.validators.StringValidator
- All Implemented Interfaces:
ParamValidator
- Direct Known Subclasses:
AbstractExpressionValidator
-
Field Summary
Fields inherited from class org.esa.snap.core.param.AbstractParamValidator
_logger -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionprotected static StringcastToString(Object value) static booleanequalValues(boolean caseSensitive, Object value1, Object value2) booleanequalValues(Parameter parameter, Object value1, Object value2) Tests if the given two values are equal taking the given parameter information into account.Converts the given text into a value taking the given parameter information into account.voidTests if the given value passes all constraints given in the supplied parameter information.protected voidvalidateThatValueIsAnAllowedEmptyValue(Parameter parameter, Object value) protected voidvalidateThatValueIsAnIdentifier(Parameter parameter, Object value) protected voidvalidateThatValueIsAString(Parameter parameter, Object value) Methods inherited from class org.esa.snap.core.param.AbstractParamValidator
isAllowedNullText, isAllowedNullValue, isValueContainedInValueSet, validateThatNullValueIsAllowed, validateThatValueIsInValueSet, validateThatValuesAreInValueSet
-
Constructor Details
-
StringValidator
public StringValidator()
-
-
Method Details
-
parse
Description copied from interface:ParamValidatorConverts the given text into a value taking the given parameter information into account.- Parameters:
parameter- the parameter, must not benulltext- the text to be converted into a value, must not benull- Returns:
- the value represented by the text
- Throws:
ParamParseException
-
format
Returns the givenstringvalue as a string, according to the rules of theparameter. If the value isnullandnull value is allowed, this method returns an empty string, otherwise aParamFormatExceptionwill be thrown.- Parameters:
parameter- the parameter which contains the rules to formatvalue- the value to format- Returns:
- the value as string or an empty string.
- Throws:
ParamFormatException- if the value isnullandnull value is not allowedor the value is not an instance ofString.
-
validate
Description copied from interface:ParamValidatorTests if the given value passes all constraints given in the supplied parameter information. The value can also benullsince parameters can be allowed to have the value 'null'.- Parameters:
parameter- the parameter, must not benullvalue- the value to be tested, can benull- Throws:
ParamValidateException
-
validateThatValueIsAString
protected void validateThatValueIsAString(Parameter parameter, Object value) throws ParamValidateException - Throws:
ParamValidateException
-
validateThatValueIsAnIdentifier
protected void validateThatValueIsAnIdentifier(Parameter parameter, Object value) throws ParamValidateException - Throws:
ParamValidateException
-
validateThatValueIsAnAllowedEmptyValue
protected void validateThatValueIsAnAllowedEmptyValue(Parameter parameter, Object value) throws ParamValidateException - Throws:
ParamValidateException
-
equalValues
Description copied from interface:ParamValidatorTests if the given two values are equal taking the given parameter information into account.- Specified by:
equalValuesin interfaceParamValidator- Overrides:
equalValuesin classAbstractParamValidator- 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
-
equalValues
-
castToString
-