|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectorg.apache.wicket.validation.ValidationError
public final class ValidationError
A versatile implementation of IValidationError that supports message resolution from
IErrorMessageSource, default message (if none of the keys matched), and variable
substitution.
The final error message is constructed via the following process:
addKey(String) via the provided
IErrorMessageSource.setMessage(String), if
any.
| Constructor Summary | |
|---|---|
ValidationError()
Constructs an empty error |
|
ValidationError(IValidator<?> validator)
Constructs a validation error with the validator's standard key. |
|
ValidationError(IValidator<?> validator,
String variation)
Constructs a validation error with a variation of validator's standard key. |
|
ValidationError(String message)
Constructs a validation error with the specified message. |
|
| Method Summary | |
|---|---|
ValidationError |
addKey(IValidator<?> validator)
Shortcut for adding a standard message key which is the simple name of the validator' class |
ValidationError |
addKey(IValidator<?> validator,
String variation)
Shortcut for adding a standard message key variation which is the simple name of the validator class followed by a dot and the variation |
ValidationError |
addKey(String key)
Adds a key to the list of keys that will be tried against IErrorMessageSource to
locate the error message string. |
ValidationError |
addMessageKey(String key)
Deprecated. use addKey(String) |
Serializable |
getErrorMessage(IErrorMessageSource messageSource)
Retrieves the error message (usually user-facing). |
List<String> |
getKeys()
Gets error keys |
String |
getMessage()
Gets the default message that will be used when no message could be located via message keys. |
Map<String,Object> |
getVariables()
Retrieves the variables map for this error. |
void |
setKeys(List<String> keys)
Sets error keys |
ValidationError |
setMessage(String message)
Sets message that will be used when no message could be located via message keys. |
ValidationError |
setVariable(String name,
Object value)
Sets a key and value in the variables map for use in substitution. |
ValidationError |
setVariables(Map<String,Object> vars)
Sets the variables map for this error. |
String |
toString()
|
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
| Constructor Detail |
|---|
public ValidationError()
public ValidationError(IValidator<?> validator)
addKey(IValidator)
validator - validator
public ValidationError(IValidator<?> validator,
String variation)
addKey(IValidator, String)
validator - validatorvariation - key variationpublic ValidationError(String message)
setMessage(String)
message - message| Method Detail |
|---|
@Deprecated public ValidationError addMessageKey(String key)
addKey(String)
IErrorMessageSource to
locate the error message string.
key -
ValidationError for chaining purposespublic ValidationError addKey(String key)
IErrorMessageSource to
locate the error message string.
key - a message key to be added
ValidationError for chaining purposespublic ValidationError addKey(IValidator<?> validator)
validator - validator
this
public ValidationError addKey(IValidator<?> validator,
String variation)
If the variation is empty only the validator's simple class name is used
validator - validatorvariation - key variation
this
public ValidationError setVariable(String name,
Object value)
name - a variable namevalue - a variable value
ValidationError for chaining purposespublic final Map<String,Object> getVariables()
Map of variables for this errorpublic final ValidationError setVariables(Map<String,Object> vars)
vars - a variables map
ValidationError for chaining purposespublic final Serializable getErrorMessage(IErrorMessageSource messageSource)
IValidationError
getErrorMessage in interface IValidationErrormessageSource - the message source
IValidationError.getErrorMessage(IErrorMessageSource)public final String getMessage()
public final ValidationError setMessage(String message)
Note: No variable substitution is performed on the given message!
message - a default message to be used when all keys yield no message
ValidationError for chaining purposespublic List<String> getKeys()
public void setKeys(List<String> keys)
keys - public String toString()
toString in class ObjectObject.toString()
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||