org.esa.beam.framework.param.validators
Class BooleanValidator
java.lang.Object
org.esa.beam.framework.param.AbstractParamValidator
org.esa.beam.framework.param.validators.BooleanValidator
- All Implemented Interfaces:
- ParamValidator
public class BooleanValidator
- extends AbstractParamValidator
| Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
TRUE_STRING
public static final String TRUE_STRING
- See Also:
- Constant Field Values
FALSE_STRING
public static final String FALSE_STRING
- See Also:
- Constant Field Values
BooleanValidator
public BooleanValidator()
parse
public Object parse(Parameter parameter,
String text)
throws ParamParseException
- Description copied from interface:
ParamValidator
- Converts the given text into a value taking the given parameter information into account.
- Parameters:
parameter - the parameter, must not be nulltext - the text to be converted into a value, must not be null
- Returns:
- the value represented by the text
- Throws:
ParamParseException
format
public String format(Parameter parameter,
Object value)
throws ParamFormatException
- Returns the given
Boolean value as a string, according to the rules of the given parameter.
If the value is null and null value is allowed,
this method returns an empty string, otherwise a ParamFormatException will 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 is null and
null value is not allowed
or the value is not an instance of Boolean.
validate
public void validate(Parameter parameter,
Object value)
throws ParamValidateException
- Description copied from interface:
ParamValidator
- Tests if the given value passes all constraints given in the supplied parameter information. The value can also
be
null since parameters can be allowed to have the value 'null'.
- Parameters:
parameter - the parameter, must not be nullvalue - the value to be tested, can be null
- Throws:
ParamValidateException
castToBoolean
protected static Boolean castToBoolean(Object value)
Copyright © 2002-2012 Brockmann Consult GmbH. All Rights Reserved.