Package org.spincast.core.validation
Interface ValidationSet
- All Known Subinterfaces:
- Form
- All Known Implementing Classes:
- FormDefault,- ValidationSetSimple
public interface ValidationSet
- 
Method SummaryModifier and TypeMethodDescriptionvoidCreates and adds a new Error validation Message.voidaddError(String validationKey, String code, String text, ValidationHtmlEscapeType htmlEscapeType) Creates and adds a new Error validation Message.voidaddMessage(String validationKey, ValidationLevel messageLevel, String code, String text) Creates and adds a new validation Message.voidaddMessage(String validationKey, ValidationLevel messageLevel, String code, String text, ValidationHtmlEscapeType htmlEscapeType) Creates and adds a new validation Message.voidaddMessage(String validationKey, ValidationMessage validationMessage) Adds a new validation Message to this set, using the specified validation key.voidaddSuccess(String validationKey, String code, String text) Creates and adds a new Success validation Message.voidaddSuccess(String validationKey, String code, String text, ValidationHtmlEscapeType htmlEscapeType) Creates and adds a new Success validation Message.voidaddWarning(String validationKey, String code, String text) Creates and adds a new Warning validation Message.)voidaddWarning(String validationKey, String code, String text, ValidationHtmlEscapeType htmlEscapeType) Creates and adds a new Warning validation Message.)voidRemoves all previously added messages and reset the validation status.Creates a newValidationSet.Gets the validation keys and their associated messages.getMessages(String validationKey) Gets the validation messages for the specified key.getMessagesFormatted(String validationKey, ValidationMessageFormatType formatType) Quick way to get a formatted version of the validation messages for the specified key.getMessagesFormatted(ValidationMessageFormatType formatType) Quick way to get a formatted version of all validation messages.TheJsonObjectin which the validation messages are actually stored.booleanDoes this validation set contain any validation Messages?booleanhasMessages(String validationKey) Does the the element at the specified key contains validation Messages?booleanisError()Returnstrueif the validation set contains at least one ERROR message.booleanReturnstrueif the validation set for the element at the specified key contains at least one ERROR message.booleanReturnstrueif the validation set only contains SUCCESS messages (or contains no messages at all).booleanReturnstrueif the validation set for the element at the specified key only contains SUCCESS messages (or contains no messages at all).booleanisValid()Returnstrueif the validation set does not contain ERROR messages.booleanReturnstrueif the validation set for the elements at the specified keys dont not contain ERROR messages.booleanReturnstrueif the validation set contains at least one WARNING message, but no ERROR messages.booleanReturnstrueif the validation set for the element at the specified key contains at least one WARNING message, but no ERROR messages.mergeValidationSet(String validationKeyPrefix, ValidationSet validationSet) Merges anotherValidationSetand prefixes all the validation keys of this set using thevalidationKeyPrefix.mergeValidationSet(ValidationSet validationSet) Merges anotherValidationSet.intsize()The number of validation messages in this set.
- 
Method Details- 
addMessageAdds a new validation Message to this set, using the specified validation key.
- 
addMessageCreates and adds a new validation Message.Escapes the message in <pre>tags if displayed in HTML.
- 
addMessagevoid addMessage(String validationKey, ValidationLevel messageLevel, String code, String text, ValidationHtmlEscapeType htmlEscapeType) Creates and adds a new validation Message.- Parameters:
- htmlEscape- if this message if displayed using- HTML, how should it be escaped?
 
- 
addErrorCreates and adds a new Error validation Message.Escapes the message in <pre>tags if displayed in HTML.
- 
addErrorvoid addError(String validationKey, String code, String text, ValidationHtmlEscapeType htmlEscapeType) Creates and adds a new Error validation Message.- Parameters:
- htmlEscape- if this message if displayed using- HTML, should should it be escaped?
 
- 
addWarningCreates and adds a new Warning validation Message.)Escapes the message in <pre>tags if displayed in HTML.
- 
addWarningvoid addWarning(String validationKey, String code, String text, ValidationHtmlEscapeType htmlEscapeType) Creates and adds a new Warning validation Message.)- Parameters:
- htmlEscape- if this message if displayed using- HTML, should should it be escaped?
 
- 
addSuccessCreates and adds a new Success validation Message.Escapes the message in <pre>tags if displayed in HTML.
- 
addSuccessvoid addSuccess(String validationKey, String code, String text, ValidationHtmlEscapeType htmlEscapeType) Creates and adds a new Success validation Message.- Parameters:
- htmlEscapeType- if this message if displayed using- HTML, should should it be escaped?
 
- 
hasMessagesboolean hasMessages()Does this validation set contain any validation Messages?
- 
hasMessagesDoes the the element at the specified key contains validation Messages?
- 
isWarningboolean isWarning()Returnstrueif the validation set contains at least one WARNING message, but no ERROR messages.
- 
isWarningReturnstrueif the validation set for the element at the specified key contains at least one WARNING message, but no ERROR messages.
- 
isSuccessboolean isSuccess()Returnstrueif the validation set only contains SUCCESS messages (or contains no messages at all).
- 
isSuccessReturnstrueif the validation set for the element at the specified key only contains SUCCESS messages (or contains no messages at all).
- 
isErrorboolean isError()Returnstrueif the validation set contains at least one ERROR message.
- 
isErrorReturnstrueif the validation set for the element at the specified key contains at least one ERROR message.
- 
isValidboolean isValid()Returnstrueif the validation set does not contain ERROR messages. The set may contain WARNING messages.This is a synonym of !isError().
- 
isValidReturnstrueif the validation set for the elements at the specified keys dont not contain ERROR messages.The elements may contains WARNING messages. If no keys are passed, then all keys must be valid (synonym of isValid().
- 
getMessagesMap<String,List<ValidationMessage>> getMessages()Gets the validation keys and their associated messages.The Map and the lists are immutable. 
- 
getMessagesGets the validation messages for the specified key.The list is immutable. 
- 
getMessagesFormattedQuick way to get a formatted version of the validation messages for the specified key.- Parameters:
- key- The key to get messages for.
- formatType- The type of output for the messages (Text, HTML, Json or XML).
- Returns:
- the formatted messages or nullif there are no validation messages.
 
- 
getMessagesFormattedQuick way to get a formatted version of all validation messages.- Parameters:
- formatType- The type of output for the messages (Text, HTML, Json or XML).
- Returns:
- the formatted messages or nullif there are no validation messages.
 
- 
createNewValidationSetValidationSet createNewValidationSet()Creates a newValidationSet.
- 
mergeValidationSetMerges anotherValidationSet.- Returns:
- this, fluent-style.
 
- 
mergeValidationSetMerges anotherValidationSetand prefixes all the validation keys of this set using thevalidationKeyPrefix.- Returns:
- this, fluent-style.
 
- 
sizeint size()The number of validation messages in this set.
- 
getValidationResultAsJsonObjectJsonObject getValidationResultAsJsonObject()TheJsonObjectin which the validation messages are actually stored.You can use this object to return the validation result as json, in a response. 
- 
clearAllValidationvoid clearAllValidation()Removes all previously added messages and reset the validation status.
 
-