|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectcom.acsinet_solutions.util.validator.ValidationIssueBuilder
public class ValidationIssueBuilder
Bean that represents a validation issue register. Issues are added to this instance using the addIssue() methods. Several convenience checkXXX() methods are added to provide common check situations. When validation conditions are checked, the check() method may be called; if any issue was detected, a ValidationException that gathers all validation issues is thrown.
WARNING! This class is not thread-safe; it is intended for single-thread use only
| Field Summary | |
|---|---|
java.util.List<ValidationIssue> |
_issues
The issues being built |
| Constructor Summary | |
|---|---|
ValidationIssueBuilder()
Public default constructor |
|
| Method Summary | |
|---|---|
void |
addIssue(java.lang.String key,
java.lang.Object... args)
Add a new validation issue |
void |
addIssue(ValidationIssue issue)
Add a new validation issue |
void |
addIssues(java.util.List<ValidationIssue> list)
Add all the issues in the given list |
void |
check()
Check if there are issues and throw a ValidationException if there are |
boolean |
checkIncluded(java.lang.Object value,
java.util.Set validValues,
java.lang.String key,
java.lang.Object... args)
Check that the given value is included in the validValues Set |
boolean |
checkMatch(java.lang.String re,
java.lang.String field,
java.lang.String key,
java.lang.Object... args)
Check that a field matches a re, and generate a validation issue if not. |
boolean |
checkNotEmpty(java.util.Collection collection,
java.lang.String key,
java.lang.Object... args)
Check that the given Collection is not null or empty. |
boolean |
checkNotEmpty(java.util.Map map,
java.lang.String key,
java.lang.Object... args)
Check that the given Map is not null or empty. |
boolean |
checkNotEmpty(java.lang.String field,
java.lang.String key,
java.lang.Object... args)
Check that the given field is not null or empty. |
boolean |
checkNotNull(java.lang.Object obj,
java.lang.String key,
java.lang.Object... args)
Check that the given reference is not null. |
boolean |
checkTrue(boolean condition,
java.lang.String key,
java.lang.Object... args)
Check that the given condition evaluates to a true value. |
int |
getSize()
Check the issues size |
boolean |
hasIssues()
Return whether the current class has raised issues or not |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Field Detail |
|---|
public final java.util.List<ValidationIssue> _issues
| Constructor Detail |
|---|
public ValidationIssueBuilder()
| Method Detail |
|---|
public final void addIssue(ValidationIssue issue)
public final void addIssue(java.lang.String key,
java.lang.Object... args)
description - A not-null not-empty issue keypublic void addIssues(java.util.List<ValidationIssue> list)
list - A not-null maybe-empty list of not-null ValidationIssue
instances.public final boolean hasIssues()
public final int getSize()
public final void check()
throws ValidationException
ValidationException
public final boolean checkTrue(boolean condition,
java.lang.String key,
java.lang.Object... args)
condition - The condition that must be true in order to
pass the checkkey - The not-null not-empty String instance that will identify
the issue to be raised if the field is null or empty.args - Extra, maybe-null arguments for the issue message.
public final boolean checkNotEmpty(java.lang.String field,
java.lang.String key,
java.lang.Object... args)
field - The maybe-null field to be checkedkey - The not-null not-empty String instance that will identify
the issue to be raised if the field is null or empty.args - Extra, maybe-null arguments for the issue message.
public final boolean checkNotEmpty(java.util.Map map,
java.lang.String key,
java.lang.Object... args)
map - The maybe-null Map to be checkedkey - The not-null not-empty String instance that will identify
the issue to be raised if the Map is null or empty.args - Extra, maybe-null arguments for the issue message.
public final boolean checkNotEmpty(java.util.Collection collection,
java.lang.String key,
java.lang.Object... args)
collection - The maybe-null Collection to be checkedkey - The not-null not-empty String instance that will identify
the issue to be raised if the Collection is null or empty.args - Extra, maybe-null arguments for the issue message.
public final boolean checkNotNull(java.lang.Object obj,
java.lang.String key,
java.lang.Object... args)
obj - The object reference.key - The not-null not-empty String instance that will identify
the issue to be raised if the Collection is null or empty.args - Extra, maybe-null arguments for the issue message.
public final boolean checkIncluded(java.lang.Object value,
java.util.Set validValues,
java.lang.String key,
java.lang.Object... args)
value - a maybe-null value instancevalidValues - a not-null Set of not-null values that will be
compared against the arg valuekey - The not-null not-empty String instance that will identify
the issue to be raised if the Collection is null or empty.args - Extra, maybe-null arguments for the issue message.
public final boolean checkMatch(java.lang.String re,
java.lang.String field,
java.lang.String key,
java.lang.Object... args)
re - The not-null valid re pattern to be matched uponfield - The not-null field to be checkedkey - The not-null not-empty String instance that will identify
the issue to be raised if the matching doesn't occur.args - Extra, maybe-null arguments for the issue message.
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||