public class StringArrayValidator extends AbstractParamValidator
_logger
Constructor and Description |
---|
StringArrayValidator() |
Modifier and Type | Method and Description |
---|---|
protected static String[] |
castToStringArray(Object value) |
boolean |
equalValues(Parameter parameter,
Object value1,
Object value2)
Tests if the given two values are equal taking the given parameter information into account.
|
String |
format(Parameter parameter,
Object value)
Returns the given
string array value as a string, according to the rules of the parameter . |
protected static int |
getValueSetIndex(String[] valueSet,
String value,
boolean caseSensitive) |
int[] |
getValueSetIndices(Parameter parameter) |
Object |
parse(Parameter parameter,
String text)
Converts the given text into a value taking the given parameter information into account.
|
void |
validate(Parameter parameter,
Object value)
Tests if the given value passes all constraints given in the supplied parameter information.
|
protected void |
validateThatValueIsAnAllowedEmptyValue(Parameter parameter,
Object value) |
isAllowedNullText, isAllowedNullValue, isValueContainedInValueSet, validateThatNullValueIsAllowed, validateThatValueIsInValueSet, validateThatValuesAreInValueSet
public Object parse(Parameter parameter, String text) throws ParamParseException
ParamValidator
parameter
- the parameter, must not be null
text
- the text to be converted into a value, must not be null
ParamParseException
public String format(Parameter parameter, Object value) throws ParamFormatException
string array
value as a string, according to the rules of the parameter
.
If the value is null
and null value is allowed
,
this method returns an empty string, otherwise a ParamFormatException
will be thrown.parameter
- the parameter which contains the rules to formatvalue
- the value to formatParamFormatException
- if the value is null
and
null value is not allowed
or the value is not an instance of String[]
.public void validate(Parameter parameter, Object value) throws ParamValidateException
ParamValidator
null
since parameters can be allowed to have the value 'null'.parameter
- the parameter, must not be null
value
- the value to be tested, can be null
ParamValidateException
protected void validateThatValueIsAnAllowedEmptyValue(Parameter parameter, Object value) throws ParamValidateException
ParamValidateException
public boolean equalValues(Parameter parameter, Object value1, Object value2)
ParamValidator
equalValues
in interface ParamValidator
equalValues
in class AbstractParamValidator
parameter
- the parameter, must not be null
value1
- the first value, can be null
value2
- the second value, can also be null
true
if the value are equal, false
otherwisepublic int[] getValueSetIndices(Parameter parameter)
Copyright © 2002–2014 Brockmann Consult GmbH. All rights reserved.