|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectorg.deduced.rule.DeductionRuleLibrary
org.deduced.validation.validator.rule.IsStringValidRule
public class IsStringValidRule

IsStringValidRule is used to validate a string using a minimum length, a maximum length, a flag indicating if the string can be null, a must-match regular expression and a must-not-match regular expression.
| Nested Class Summary |
|---|
| Nested classes/interfaces inherited from class org.deduced.rule.DeductionRuleLibrary |
|---|
DeductionRuleLibrary.CompareResult |
| Field Summary | |
|---|---|
private static int |
ERROR_MESSAGE_SUBSTRING_LENGTH
length of error substrings |
private static int |
PARAMETER_3
Used to avoid javadoc warning for magic numbers |
private static int |
PARAMETER_4
Used to avoid javadoc warning for magic numbers |
private static int |
PARAMETER_5
Used to avoid javadoc warning for magic numbers |
private static int |
PARAMETER_6
Used to avoid javadoc warning for magic numbers |
| Constructor Summary | |
|---|---|
IsStringValidRule()
|
|
| Method Summary | |
|---|---|
java.lang.Object |
analyzeRule(java.lang.Object[] inputs,
RuleExecutionContext context,
PropertyCollection<?,?> collection,
PropertyCollection<?,?> rule)
(non-Javadoc) |
private static java.lang.String |
checkInvalidRegularExpression(java.lang.String invalidRegularExpression,
java.lang.String stringValue)
validate String doesn't match a invalid regular expression |
private static java.lang.String |
checkValidRegularExpression(java.lang.String validRegularExpression,
java.lang.String stringValue)
validate String match a valid regular expression |
static java.lang.String |
fetchSubString(java.lang.String value,
int maxLength)
Fetch a sub string used during error reporting to avoid error messages that are too long. |
private static java.lang.String |
validateMultipleLinesAllowed(java.lang.Boolean isMultipleLinesAllowed,
java.lang.String stringValue)
validate String doesn't contain multiple lines if it's not allowed. |
static java.lang.String |
validateString(java.lang.Object value,
java.lang.Integer min,
java.lang.Integer max,
java.lang.Boolean canBeNull,
java.lang.String validRegularExpression,
java.lang.String invalidRegularExpression,
java.lang.Boolean isMultipleLinesAllowed)
validate a string |
private static java.lang.String |
validateStringMaximumLength(java.lang.Integer max,
java.lang.String stringValue)
validate String Maximum Length |
private static java.lang.String |
validateStringMinimumLength(java.lang.Integer min,
java.lang.String stringValue)
validate String Minimum Length |
| Methods inherited from class org.deduced.rule.DeductionRuleLibrary |
|---|
addReferenceToList, and, bigger, biggerOrEqual, createDateIncrementList, createObject, createObjectsMatchingAllValues, createObjectsMatchingAllValues, debug, equalTo, fillList, filter, filterList, filterList, filterList, findParentOfType, formatDate, formatDate, formatTime, instanceOf, maximumCollection, maximumValue, merge, minimumCollection, minimumValue, not, or, property, same, smaller, smallerOrEqual, sum, sum |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Field Detail |
|---|
private static final int PARAMETER_3
private static final int PARAMETER_4
private static final int PARAMETER_5
private static final int PARAMETER_6
private static final int ERROR_MESSAGE_SUBSTRING_LENGTH
| Constructor Detail |
|---|
public IsStringValidRule()
| Method Detail |
|---|
public java.lang.Object analyzeRule(java.lang.Object[] inputs,
RuleExecutionContext context,
PropertyCollection<?,?> collection,
PropertyCollection<?,?> rule)
inputs - the array of inputscontext - the rule execution contextcollection - the collection on which the rule is executedrule - the rule being executed
DeductionRuleAnalyzer.analyzeRule(java.lang.Object[],
org.deduced.RuleExecutionContext, org.deduced.PropertyCollection,
org.deduced.PropertyCollection)
public static java.lang.String validateString(java.lang.Object value,
java.lang.Integer min,
java.lang.Integer max,
java.lang.Boolean canBeNull,
java.lang.String validRegularExpression,
java.lang.String invalidRegularExpression,
java.lang.Boolean isMultipleLinesAllowed)
value - the current string valuemin - the string minimum length. If null, the string doesn't need to
respect a minimum length.max - the string maximum length. If null, the string doesn't need to
respect a maximum length.canBeNull - flag indicating if the string is allowed to be null.validRegularExpression - the regular expression to match to be
valid.invalidRegularExpression - the regular expression that must not be
matched to be valid.isMultipleLinesAllowed - option to indicate if multiple lines are
allowed
private static java.lang.String validateMultipleLinesAllowed(java.lang.Boolean isMultipleLinesAllowed,
java.lang.String stringValue)
isMultipleLinesAllowed - option if multiple lines are allowedstringValue - the string value
private static java.lang.String checkInvalidRegularExpression(java.lang.String invalidRegularExpression,
java.lang.String stringValue)
invalidRegularExpression - the invalid regular expressionstringValue - the string value
private static java.lang.String checkValidRegularExpression(java.lang.String validRegularExpression,
java.lang.String stringValue)
validRegularExpression - the valid regular expressionstringValue - the string value
private static java.lang.String validateStringMaximumLength(java.lang.Integer max,
java.lang.String stringValue)
max - the Maximum lengthstringValue - the string value
private static java.lang.String validateStringMinimumLength(java.lang.Integer min,
java.lang.String stringValue)
min - the minimum lengthstringValue - the string value
public static java.lang.String fetchSubString(java.lang.String value,
int maxLength)
value - the string valuemaxLength - the maximum string length that can be returned
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||