org.exolab.castor.xml.validators
Class StringValidator
- TypeValidator
public class StringValidator
The String Validation class.
$Revision: 6587 $ $Date: 2004-12-11 02:13:52 -0700 (Sat, 11 Dec 2004) $
void | clearFixed() - Clears the fixed value for this ShortValidator.
|
String | normalize(String value) - Normalizes the given string according to the whiteSpace facet used.
|
void | setFixed(String fixedValue) - Sets the fixed value in which all valid Strings must match.
|
void | setFixedValue(String fixedValue) - since 0.9.4_beta
|
void | setLength(int length) - Sets the required string length for String validation.
|
void | setMaxLength(int maxLength) - Sets the maximum string length for String validation.
|
void | setMinLength(int minLength) - Sets the minimum string length for String validation.
|
void | setRequired(boolean required) - Sets whether or not a String is required (non null).
|
void | setWhiteSpace(String value) - Sets the whiteSpace facet of the validator.
|
void | validate(Object object) - Validates the given Object.
|
void | validate(Object object, ValidationContext context) - Validates the given Object.
|
void | validate(String value, ValidationContext context) - Validates the given Object.
|
StringValidator
public StringValidator()
Creates a new StringValidator with no restrictions.
clearFixed
public void clearFixed()
Clears the fixed value for this ShortValidator.
normalize
public String normalize(String value)
Normalizes the given string according to the whiteSpace facet used.
FIXME: THIS METHOD SHOULD NOT BE HERE..SHOULD BE MOVED TO A FieldHandler
or to the Unmarshaller...but not here!!! (kvisco 20030125)
value
- the String to normalize
setFixed
public void setFixed(String fixedValue)
Sets the fixed value in which all valid Strings must match.
fixedValue
- the fixed value that all Strings must match
setFixedValue
public void setFixedValue(String fixedValue)
since 0.9.4_beta
Only used for backward compatibility for object model generated with an
old version of Castor.
fixedValue
- the fixed value that all Strings must match
setLength
public void setLength(int length)
Sets the required string length for String validation. To pass
validation, a String must be exactly this many characters long. To remove
this facet, set a negative value.
length
- the required length for valid Strings
setMaxLength
public void setMaxLength(int maxLength)
Sets the maximum string length for String validation. To pass validation,
a String must be shorter than or equal to this length. To remove this
facet, set a negative value.
maxLength
- the maximum length for valid Strings
setMinLength
public void setMinLength(int minLength)
Sets the minimum string length for String validation. To pass validation,
a String must be longer than or equal to this length. To remove this
facet, set a negative value.
minLength
- the minimum length for valid Strings
setRequired
public void setRequired(boolean required)
Sets whether or not a String is required (non null).
required
- the flag indicating whether this string must be non-null.
setWhiteSpace
public void setWhiteSpace(String value)
Sets the whiteSpace facet of the validator.
The value of the whiteSpace facet must be one of the following:
any other value will generate a Warning and set the whiteSpace to
preserve.
FIXME: This is not really a function of validation, but of XML
processing before the string is returned from the XML processor. This
should be moved to the FieldHandler, or somewhere else, but not here.
value
- the whiteSpace value
validate
public void validate(Object object)
throws ValidationException
Validates the given Object.
object
- the Object to validate
Intalio Inc. (C) 1999-2008. All rights reserved http://www.intalio.com