|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||
V - The value type this validator supports.public interface Validator<V>
Indicates an object that can determine whether a value is valid. The invalid value message should be in the form "Invalid value: '{0}'.", where "{0}" represents the invalid value.
Resources.VALIDATOR_INVALID_VALUE_MESSAGE_RESOURCE_REFERENCE,
Resources.VALIDATOR_VALUE_REQUIRED_MESSAGE_RESOURCE_REFERENCE| Field Summary | |
|---|---|
static java.lang.String |
INVALID_VALUE_MESSAGE_PROPERTY
The invalid value message bound property. |
static java.lang.String |
VALUE_REQUIRED_MESSAGE_PROPERTY
The value required message bound property. |
static java.lang.String |
VALUE_REQUIRED_PROPERTY
The value required bound property. |
| Method Summary | |
|---|---|
java.lang.String |
getInvalidValueMessage()
|
GuiseSession |
getSession()
|
java.lang.String |
getValueRequiredMessage()
|
boolean |
isValid(V value)
Determines whether a given value is valid. |
void |
setInvalidValueMessage(java.lang.String newInvalidValueMessage)
Sets the text of the invalid value message. |
void |
setValueRequiredMessage(java.lang.String newValueRequiredMessage)
Sets the text of the value required message. |
void |
validate(V value)
Checks whether a given value is valid, and throws an exception if not. |
| Methods inherited from interface com.globalmentor.beans.PropertyBindable |
|---|
addPropertyChangeListener, addPropertyChangeListener, getPropertyChangeListeners, getPropertyChangeListeners, hasPropertyChangeListeners, removePropertyChangeListener, removePropertyChangeListener |
| Field Detail |
|---|
static final java.lang.String INVALID_VALUE_MESSAGE_PROPERTY
static final java.lang.String VALUE_REQUIRED_MESSAGE_PROPERTY
static final java.lang.String VALUE_REQUIRED_PROPERTY
| Method Detail |
|---|
java.lang.String getInvalidValueMessage()
void setInvalidValueMessage(java.lang.String newInvalidValueMessage)
newInvalidValueMessage - The new text of the invalid value message, which may include a resource reference.
java.lang.NullPointerException - if the given message is null.INVALID_VALUE_MESSAGE_PROPERTYjava.lang.String getValueRequiredMessage()
void setValueRequiredMessage(java.lang.String newValueRequiredMessage)
newValueRequiredMessage - The new text of the value required message, which may include a resource reference..
java.lang.NullPointerException - if the given message is null.#VALUE_REQUIRED_VALUE_MESSAGE_PROPERTYGuiseSession getSession()
void validate(V value)
throws ValidationException
The message of the thrown exception should be appropriate for display to the user, although it may include string resource references.
If a child class has no specific message to return, that class may call #throwInvalidValueValidationException(Object) as a convenience.
A child class may also call #throwValueRequiredValidationException(Object) as a convenience,
but this is usually not required if this version of the method, which provides a missing value check, is called first.
This version checks whether a value is provided if values are required.
Child classes should call this version as a convenience for checking non-null and required status.
Adding new validation logic always requires overriding this method.
Although isValid(Object) may be overridden to provide optimized fast-fail determinations,
adding new logic to isValid(Object) cannot be used in place of overriding this method.
value - The value to validate, which may be null.
ValidationException - if the provided value is not valid.#throwInvalidValueValidationException(Object),
#throwValueRequiredValidationException(Object)boolean isValid(V value)
validate(Object), returning false only if an exception is thrown.
Although this method may be overridden to provide optimized fast-fail determinations,
adding new logic to this method cannot be used in place of overriding validate(Object).
value - The value to validate.
true if a value is given and the value is valid; or a value is not required, else false.
|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||