public class SizeValidator extends Object
AbstractValidator which verifies that typedValue has a size between certain inclusive boundaries. This
validator is capable of handling instances of String, Collection, Map and arrays| Constructor and Description |
|---|
SizeValidator(org.mule.runtime.api.metadata.TypedValue typedValue,
int minSize,
Integer maxSize,
ValidationContext validationContext,
org.mule.runtime.api.el.ExpressionLanguage expressionLanguage) |
| Modifier and Type | Method and Description |
|---|---|
protected ValidationResult |
fail()
Generates a
ValidationResult which ValidationResult.isError() method returns true and which message
is the return value of getDefaultErrorMessage(). |
protected org.mule.runtime.api.i18n.I18nMessage |
getDefaultErrorMessage()
Implementations need to implement this method to return the error message in case the validation failed
|
protected ValidationErrorType |
getErrorType()
Defines the error type associated to this validation.
|
protected ValidationMessages |
getMessages()
Returns the
ValidationMessages instance to use |
ValidationResult |
validate()
Performs the validation and generates a
ValidationResult back. |
public SizeValidator(org.mule.runtime.api.metadata.TypedValue typedValue,
int minSize,
Integer maxSize,
ValidationContext validationContext,
org.mule.runtime.api.el.ExpressionLanguage expressionLanguage)
public ValidationResult validate()
ValidatorValidationResult back.ValidationResultprotected ValidationErrorType getErrorType()
ValidationErrorType.VALIDATION but implementations
can override it.ValidationErrorTypeprotected org.mule.runtime.api.i18n.I18nMessage getDefaultErrorMessage()
I18nMessageprotected ValidationMessages getMessages()
ValidationMessages instance to useValidationMessages instanceprotected ValidationResult fail()
ValidationResult which ValidationResult.isError() method returns true and which message
is the return value of getDefaultErrorMessage(). If the error messagee is an expression, it will be evaluated before
constructing the result objectValidationResultCopyright © 2018 MuleSoft, Inc.. All rights reserved.