@Validator public final class CommonValidationOperations extends Object
ValidationExtension which executes the Validators that the extension provides out of
the boxValidationExtension| Modifier and Type | Field and Description |
|---|---|
protected static String |
ERROR_GROUP |
protected static org.slf4j.Logger |
LOGGER |
| Constructor and Description |
|---|
CommonValidationOperations() |
| Modifier and Type | Method and Description |
|---|---|
protected ValidationContext |
createContext(ValidationOptions options,
ValidationExtension config) |
void |
isBlankString(String value,
ValidationOptions options,
ValidationExtension config)
Validates that
value is a blank String. |
void |
isElapsed(Long time,
TimeUnit timeUnit,
LocalDateTime since,
ValidationOptions options,
ValidationExtension config)
Validates the amount of time that has elapsed since the moment in the
since parameter is greater than an
specified amount of time. |
void |
isEmail(String email,
ValidationOptions options,
ValidationExtension config)
Validates that the
email address is valid |
void |
isEmptyCollection(Collection<Object> values,
ValidationOptions options,
ValidationExtension config)
Validates that
value is an empty collection. |
void |
isFalse(boolean expression,
ValidationOptions options,
ValidationExtension config)
Validates that the given
value is false |
void |
isIp(String ip,
ValidationOptions options,
ValidationExtension config)
Validates that an
ip address represented as a String is valid |
void |
isNotBlacklistedIp(String ipAddress,
IpFilterList blackList,
ValidationOptions options,
ValidationExtension config)
Validates that a
ipAddress is not present in the ipList. |
void |
isNotBlankString(String value,
ValidationOptions options,
ValidationExtension config)
Validates that
value is not a blank String. |
void |
isNotElapsed(Long time,
TimeUnit timeUnit,
LocalDateTime since,
ValidationOptions options,
ValidationExtension config)
Validates the amount of time that has elapsed since the moment in the
since parameter is greater than an
specified amount of time. |
void |
isNotEmptyCollection(Collection<Object> values,
ValidationOptions options,
ValidationExtension config)
Validates that
value is not an empty collection. |
void |
isNotNull(org.mule.runtime.extension.api.runtime.parameter.ParameterResolver<Object> value,
ValidationOptions options,
ValidationExtension config)
Validates that the given
value is not null. |
void |
isNull(org.mule.runtime.extension.api.runtime.parameter.ParameterResolver<Object> value,
ValidationOptions options,
ValidationExtension config)
Validates that the given
value is null. |
void |
isTime(String time,
String locale,
String pattern,
ValidationOptions options,
ValidationExtension config)
|
void |
isTrue(boolean expression,
ValidationOptions options,
ValidationExtension config)
Validates that the given
value is true |
void |
isUrl(String url,
ValidationOptions options,
ValidationExtension config)
Validates that
url is a valid one |
void |
isWhitelistedIp(String ipAddress,
IpFilterList whiteList,
ValidationOptions options,
ValidationExtension config)
Validates that a
ipAddress is present in the ipList. |
protected void |
logSuccessfulValidation(Validator validator) |
void |
matchesRegex(String value,
String regex,
boolean caseSensitive,
ValidationOptions options,
ValidationExtension config)
Validates that
value matches the regex regular expression |
protected Locale |
parseLocale(String locale) |
void |
validateSize(Object value,
int min,
Integer max,
ValidationOptions options,
ValidationExtension config)
Validates that
value has a size between certain inclusive boundaries. |
protected void |
validateWith(Validator validator,
ValidationContext validationContext) |
protected static final String ERROR_GROUP
protected static final org.slf4j.Logger LOGGER
@Throws(value=BooleanErrorType.class) public void isTrue(boolean expression, @ParameterGroup(name="Error options") ValidationOptions options, @Config ValidationExtension config) throws Exception
value is trueexpression - the boolean to testoptions - the ValidationOptionsconfig - the current ValidationExtension that serves as configException - if the value is not true@Throws(value=BooleanErrorType.class) public void isFalse(boolean expression, @ParameterGroup(name="Error options") ValidationOptions options, @Config ValidationExtension config) throws Exception
value is falseexpression - the boolean to testoptions - the ValidationOptionsconfig - the current ValidationExtension that serves as configException - if the value is not true@Throws(value=EmailErrorType.class) public void isEmail(String email, @ParameterGroup(name="Error options") ValidationOptions options, @Config ValidationExtension config) throws Exception
email address is validemail - an email addressoptions - the ValidationOptionsconfig - the current ValidationExtension that serves as configException@DisplayName(value="Is IP") @Throws(value=IpErrorType.class) public void isIp(String ip, @ParameterGroup(name="Error options") ValidationOptions options, @Config ValidationExtension config) throws Exception
ip address represented as a String is validip - the ip address to validateoptions - the ValidationOptionsconfig - the current ValidationExtension that serves as configException@Throws(value=SizeErrorType.class) public void validateSize(Object value, @Optional(defaultValue="0") int min, @Optional Integer max, @ParameterGroup(name="Error options") ValidationOptions options, @Config ValidationExtension config) throws Exception
value has a size between certain inclusive boundaries. This validator is capable of handling instances
of String, Collection, Map and arraysvalue - the value to validatemin - the minimum expected length (inclusive, defaults to zero)max - the maximum expected length (inclusive). Leave unspecified or null to allow any max lengthoptions - the ValidationOptionsconfig - the current ValidationExtension that serves as configException@Throws(value=BlankErrorType.class) public void isNotBlankString(@Optional(defaultValue="#[payload]") String value, @ParameterGroup(name="Error options") ValidationOptions options, @Config ValidationExtension config) throws Exception
value is not a blank String.value - the String to checkoptions - the ValidationOptionsconfig - the current ValidationExtension that serves as configException@Throws(value=EmptyErrorType.class) public void isNotEmptyCollection(@Optional(defaultValue="#[payload]") Collection<Object> values, @ParameterGroup(name="Error options") ValidationOptions options, @Config ValidationExtension config) throws Exception
value is not an empty collection.values - the value to checkoptions - the ValidationOptionsconfig - the current ValidationExtension that serves as configException@Throws(value=NotBlankErrorType.class) public void isBlankString(String value, @ParameterGroup(name="Error options") ValidationOptions options, @Config ValidationExtension config) throws Exception
value is a blank String.value - the value to checkoptions - the ValidationOptionsconfig - the current ValidationExtension that serves as configException@Throws(value=NotEmptyErrorType.class) public void isEmptyCollection(@Optional(defaultValue="#[payload]") Collection<Object> values, @ParameterGroup(name="Error options") ValidationOptions options, @Config ValidationExtension config) throws Exception
value is an empty collection.values - the value to checkoptions - the ValidationOptionsconfig - the current ValidationExtension that serves as configException@Throws(value=NullErrorType.class) public void isNotNull(org.mule.runtime.extension.api.runtime.parameter.ParameterResolver<Object> value, @ParameterGroup(name="Error options") ValidationOptions options, @Config ValidationExtension config) throws Exception
value is not null.value - the value to testoptions - the ValidationOptionsconfig - the current ValidationExtension that serves as configException@Throws(value=NotNullErrorType.class) public void isNull(org.mule.runtime.extension.api.runtime.parameter.ParameterResolver<Object> value, @ParameterGroup(name="Error options") ValidationOptions options, @Config ValidationExtension config) throws Exception
value is null.value - the value to testoptions - the ValidationOptionsconfig - the current ValidationExtension that serves as configException@Throws(value=TimeErrorType.class) public void isTime(String time, @Optional String locale, @Optional String pattern, @ParameterGroup(name="Error options") ValidationOptions options, @Config ValidationExtension config) throws Exception
time in String format is valid for the given pattern and locale. If no
pattern is provided, then the locale's default will be usedtime - A date in String formatlocale - the locale of the Stringpattern - the pattern for the dateoptions - the ValidationOptionsconfig - the current ValidationExtension that serves as configException@Throws(value=NotElapsedErrorType.class) public void isElapsed(Long time, TimeUnit timeUnit, LocalDateTime since, @ParameterGroup(name="Error options") ValidationOptions options, @Config ValidationExtension config) throws Exception
since parameter is greater than an
specified amount of time.time - the interval sizetimeUnit - the interval unit (as a TimeUnit)since - the time to validateoptions - the ValidationOptionsconfig - the current ValidationExtension that serves as configException@Throws(value=ElapsedErrorType.class) public void isNotElapsed(Long time, TimeUnit timeUnit, LocalDateTime since, @ParameterGroup(name="Error options") ValidationOptions options, @Config ValidationExtension config) throws Exception
since parameter is greater than an
specified amount of time.time - the interval sizetimeUnit - the interval unit (as a TimeUnit)since - the time to validateoptions - the ValidationOptionsconfig - the current ValidationExtension that serves as configException@DisplayName(value="Is URL") @Throws(value=UrlErrorType.class) public void isUrl(@DisplayName(value="URL") String url, @ParameterGroup(name="Error options") ValidationOptions options, @Config ValidationExtension config) throws Exception
url is a valid oneurl - the URL to validate as a Stringoptions - the ValidationOptionsconfig - the current ValidationExtension that serves as configException@Throws(value=RegexErrorType.class) public void matchesRegex(String value, String regex, @Optional(defaultValue="true") boolean caseSensitive, @ParameterGroup(name="Error options") ValidationOptions options, @Config ValidationExtension config) throws Exception
value matches the regex regular expressionvalue - the value to checkregex - the regular expression to check againstcaseSensitive - when true matching is case sensitive, otherwise matching is case in-sensitiveoptions - the ValidationOptionsconfig - the current ValidationExtension that serves as configException@Throws(value={IpErrorType.class,IpFilterErrorType.class})
public void isWhitelistedIp(String ipAddress,
IpFilterList whiteList,
@ParameterGroup(name="Error options")
ValidationOptions options,
@Config
ValidationExtension config)
throws Exception
ipAddress is present in the ipList.ipAddress - the address to validatewhiteList - the list of allowed addressesoptions - the ValidationOptionsconfig - the current ValidationExtension that serves as configException@Throws(value={IpErrorType.class,IpFilterErrorType.class})
public void isNotBlacklistedIp(String ipAddress,
IpFilterList blackList,
@ParameterGroup(name="Error options")
ValidationOptions options,
@Config
ValidationExtension config)
throws Exception
ipAddress is not present in the ipList.ipAddress - the address to validateblackList - the list of disallowed addressesoptions - the ValidationOptionsconfig - the current ValidationExtension that serves as configExceptionprotected void validateWith(Validator validator, ValidationContext validationContext) throws Exception
Exceptionprotected ValidationContext createContext(ValidationOptions options, ValidationExtension config)
protected void logSuccessfulValidation(Validator validator)
Copyright © 2018 MuleSoft, Inc.. All rights reserved.