com.sas.util.validators
Class RequiredStringValidator

com.sas.util.validators.RequiredStringValidator
All Implemented Interfaces:
ValidationInterface, java.io.Serializable

public class RequiredStringValidator

A Validator that validates that the value entered is not null, a zero-length string, or consists only of whitespace.

See Also:
Serialized Form

Field Summary
protected static int INVALID_LENGTH
           
static java.lang.String invalidLength
           
protected static int NOT_STRING
           
static java.lang.String notString
           
static java.lang.String RB_KEY
           
 
Fields inherited from class com.sas.util.validators.Validator
message, messages, msgObject
 
Constructor Summary
RequiredStringValidator()
          Default constructor
RequiredStringValidator(java.lang.String customValidationMessage)
          Constructor that displays a custom validation message.
 
Method Summary
 void createValidationMessages()
          createValidationMessages is called by the constructor to create the collection of message objects that are accessed by validateValue.
 boolean validateValue(java.lang.Object component, java.lang.Object value)
          Default implementation.
 
Methods inherited from class com.sas.util.validators.Validator
getExtendedBeanInfo, getValidationMessage, getValidationMessageCode, newValidationMessage, normalizeValue, setValidationMessage, setValidationMessageCode
 

Field Detail

RB_KEY

public static final java.lang.String RB_KEY
See Also:
Constant Field Values

invalidLength

public static final java.lang.String invalidLength
See Also:
Constant Field Values

notString

public static final java.lang.String notString
See Also:
Constant Field Values

INVALID_LENGTH

protected static final int INVALID_LENGTH
See Also:
Constant Field Values

NOT_STRING

protected static final int NOT_STRING
See Also:
Constant Field Values
Constructor Detail

RequiredStringValidator

public RequiredStringValidator()
Default constructor


RequiredStringValidator

public RequiredStringValidator(java.lang.String customValidationMessage)
Constructor that displays a custom validation message. The validation message is displayed when the value entered in the field is invalid.

Parameters:
customValidationMessage - message to be displayed when value is invalid
Method Detail

validateValue

public boolean validateValue(java.lang.Object component,
                             java.lang.Object value)
Description copied from class: Validator
Default implementation. Returns true. Subclasses should override and perform the actual validation.

Specified by:
validateValue in interface ValidationInterface
Overrides:
validateValue in class Validator
Parameters:
component - an object containing the value
value - the value to be validated
Returns:
true if the value us valid, false if not. If false is returned, the validator should call setValidationMessage with a String for a reason.
See Also:
ValidationInterface.validateValue(java.lang.Object, java.lang.Object)

createValidationMessages

public void createValidationMessages()
Description copied from class: Validator
createValidationMessages is called by the constructor to create the collection of message objects that are accessed by validateValue. This can be overridden by subclasses to allow for different messages to be displayed. For each message, newValidationMessage is called to create the actual Message object. Other data can then be set on the Message object if desired.

Overrides:
createValidationMessages in class Validator
See Also:
Validator.newValidationMessage(java.lang.String)



Copyright © 2009 SAS Institute Inc. All Rights Reserved.