All Libraries | This Library | Package | Class | Use | Tree | Deprecated | Index | Grand Index | Help
|  | Components |
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

## com.sas.util.validators
Class DateStringValidator

    com.sas.util.validators.DateStringValidator

All Implemented Interfaces:
  ValidationInterface, java.io.Serializable

    public class DateStringValidator

A Validator that validates a String value according to a DateFormat

See Also:
  Serialized Form

Field Summary
`protected java.text.DateFormat` | `format` The format used to parse strings as date values.
`protected static int` | `INVALID_FORMAT` Index in messages collection where the invlalidFormat message is.
`static java.lang.String` | `invalidFormat` message key indicating validateValue failed because the string value could not be parsed according to the DateFormat.
`protected static int` | `ONLY_STRING` Index in messages collection where the onlyString message is.
`static java.lang.String` | `onlyString` message key indicating validateValue failed because the value passsed was not a String.
`static java.lang.String` | `RB_KEY`

Fields inherited from class com.sas.util.validators.Validator
`message, messages, msgObject`

Constructor Summary
`DateStringValidator()` Deprecated. this constructor is deprecated; you should construct the DateStringValidator with a DateFormat, or call setFormat(DateFormat)
`DateStringValidator(java.text.DateFormat format)` Construct a DateStringValidator which validates String values by prsing them with a DateFormat.
`DateStringValidator(java.lang.String formatString)` Construct a DateStringValidator which validates String values by parsing them with a java.text.SimpleDateFormat constructed from the formatString.

Method Summary
`void` | `createValidationMessages()` Stores in the messages collection the set of possible messages generated by validateValue
`java.text.DateFormat` | `getFormat()` Return the DateFormat used to parse string values as Dates.
`void` | `setFormat(java.text.DateFormat newFormat)` Set the DateFormat format used to parse strings values as dates.
`boolean` | `validateValue(java.lang.Object component, java.lang.Object value)` Validate a value

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

### INVALID_FORMAT

    protected static int INVALID_FORMAT

  Index in messages collection where the invlalidFormat message is.

### ONLY_STRING

    protected static int ONLY_STRING

  Index in messages collection where the onlyString message is.

### invalidFormat

    public static final java.lang.String invalidFormat

  message key indicating validateValue failed because the string value could not be parsed according to the DateFormat.

  See Also:
    Constant Field Values

### onlyString

    public static final java.lang.String onlyString

  message key indicating validateValue failed because the value passsed was not a String.

  See Also:
    Constant Field Values

### format

    protected java.text.DateFormat format

  The format used to parse strings as date values. This may be null; if null, then the deprecated java.util.Date(String) constructor is used to parse.

Constructor Detail

### DateStringValidator

    public DateStringValidator()

  Deprecated. this constructor is deprecated; you should construct the DateStringValidator with a DateFormat, or call setFormat(DateFormat)

  Construct a default DateStringValidator which will validate a String according to the java.util.Date(String) constructor which allows date strings in various form:
  - "14 Feb 96 17:04:15"
  - "5 May 1992"
  - "Tue, 24 Jul 1990"

  See Also:
    `DateStringValidator(java.text.DateFormat)`, `DateStringValidator(java.lang.String)`

### DateStringValidator

    public DateStringValidator(java.lang.String formatString)

  Construct a DateStringValidator which validates String values by parsing them with a java.text.SimpleDateFormat constructed from the formatString.

  Parameters:
    `formatString` - a String used to construct a java.text.SimpleDateFormat which is used to parse a date strings.

### DateStringValidator

    public DateStringValidator(java.text.DateFormat format)

  Construct a DateStringValidator which validates String values by prsing them with a DateFormat. The validateValue() method will call format.parse(String).

  Parameters:
    `format` - a DateFormat object to use to parse a date strings.

Method Detail

### setFormat

    public void setFormat(java.text.DateFormat newFormat)

  Set the DateFormat format used to parse strings values as dates.

  Parameters:
    `newFormat` - the new value for the format property. If null, use the Date(String) constructor.

### getFormat

    public java.text.DateFormat getFormat()

  Return the DateFormat used to parse string values as Dates.

  Returns:
    the value of the format property. If null, If null, the validator uses the Date(String) constructor.

### validateValue

    public boolean validateValue(java.lang.Object component,
                                 java.lang.Object value)

  Validate a value

  Specified by:
    `validateValue` in interface `ValidationInterface`
  Overrides:
    `validateValue` in class `Validator`
  Parameters:
    `component` - the component containing the value
    `value` - the value to be validated
  Returns:
    true if the value us valid, false if not.
  See Also:
    `ValidationInterface.validateValue(java.lang.Object, java.lang.Object)`

### createValidationMessages

    public void createValidationMessages()

  Stores in the messages collection the set of possible messages generated by validateValue

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

All Libraries | This Library | Package | Class | Use | Tree | Deprecated | Index | Grand Index | Help
|  | Components |
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

Copyright © 2009 SAS Institute Inc. All Rights Reserved.