public class ValidationResult extends AbstractObservable
| Modifier and Type | Field and Description |
|---|---|
static ValidationResult |
EMPTY |
mutex| Modifier | Constructor and Description |
|---|---|
|
ValidationResult()
Creates empty validation result
|
|
ValidationResult(List<ValidationInfo> result)
Creates validation result with root validation violations as specified
|
|
ValidationResult(List<ValidationInfo> result,
String prefix,
boolean withPrefix)
Creates validation result with or without given prefix
|
protected |
ValidationResult(ValidationInfoFactory infoFactory,
boolean dirty,
List<ValidationInfo> result) |
| Modifier and Type | Method and Description |
|---|---|
void |
addValidationInfo(String path,
Collection<ValidationInfo> validationInfos)
Adds new validation violations to current container.
|
void |
addValidationInfo(ValidationInfo info)
Adds new validation violation to current container.
|
protected boolean |
checkDirty()
Checks whether container is sorted.
|
void |
clear()
Removes all validation violations registered in current container.
|
boolean |
contains(String path)
Checks whether container contains any validation violation for specified path.
|
boolean |
containsNotConfirmedSeverity(ValidationSeverity severity)
Checks whether container contains any validation violation with specified severity that is not confirmed.
|
boolean |
containsSeverity(ValidationSeverity severity)
Checks whether container contains any validation violation with specified severity.
|
protected List<ValidationInfo> |
createResultList(List<ValidationInfo> init) |
protected ValidationInfoFactory |
createWithoutPrefixFactory(String prefix) |
protected ValidationInfoFactory |
createWithPrefixFactory(String prefix) |
boolean |
equals(Object o) |
ValidationResultSet |
find(String path)
Gets all validation violations contained by this container that are related to specified path or it's subpaths.
|
ValidationResultSet |
findNotConfirmed(String path)
Gets all validation violations contained by this container that are related to specified path or it's subpaths and
are not confirmed.
|
ValidationResultSet |
get(String prefix)
Gets all validation violations contained by this container that are related to specified prefix or it's subpaths.
|
ValidationResultSet |
get(ValidationSeverity severity)
Gets all validation violations contained by this container that has specified severity level.
|
List<ValidationInfo> |
getAll()
Gets all validation violations that are contained by this container.
|
ValidationResultSet |
getConfirmed()
Gets all validation violations contained by this container that are confirmed.
|
ValidationSeverity |
getHighestNotConfirmedSeverity()
Gets highest severity of violations contained by container that are not confirmed.
|
ValidationInfo |
getHighestNotConfirmedSeverityInfo()
Gets violation with highest severity of violations contained by container that are not confirmed.
|
ValidationSeverity |
getHighestSeverity()
Gets highest severity of violations contained by container.
|
ValidationInfo |
getHighestSeverityInfo()
Gets violation with highest severity of violations contained by container.
|
ValidationResultSet |
getNotConfirmed()
Gets all validation violations contained by this container that are not confirmed.
|
ValidationResultSet |
getNotConfirmed(String path)
Gets all validation violations contained by this container that are related to specified path or it's subpaths and
are not confirmed.
|
ValidationResultSet |
getNotConfirmed(ValidationSeverity severity)
Gets all validation violations contained by this container that has specified severity level are not confirmed.
|
protected Stream<ValidationInfo> |
getNotConfirmedStream(String path) |
protected Stream<ValidationInfo> |
getStream(String path) |
int |
hashCode() |
protected boolean |
isDirty()
Checks whether container is sorted.
|
protected void |
markDirty()
Marks container as unsorted
|
protected boolean |
pathsMatches(String expected,
String actual)
Checks whether provided paths matches
|
protected void |
removeImmediately(String path) |
void |
removeValidationInfo(String path)
Removes all validation violations from specified path and its subpaths from current container with provided.
|
void |
removeValidationInfo(ValidationInfo info)
Removes validation violation from current container
|
void |
setValidationInfo(Collection<ValidationInfo> validationInfos)
Replaces all validation violations registered in current container with provided.
|
void |
setValidationInfo(String path,
Collection<ValidationInfo> validationInfos)
Replaces violations related to provided path with their new instances.
|
int |
size()
Gets number of violations contained by this container
|
void |
updateValidationInfo(Collection<ValidationInfo> validationInfos)
Replaces violations with their new instances.
|
void |
updateValidationInfo(String path,
Collection<ValidationInfo> validationInfos)
Replaces violations with their new instances.
|
addObserver, alreadyExists, changed, changed, getObservedValues, getObservers, removeObserver, removeObserverclone, finalize, getClass, notify, notifyAll, toString, wait, wait, waitaddObserverpublic static final ValidationResult EMPTY
public ValidationResult()
public ValidationResult(List<ValidationInfo> result, String prefix, boolean withPrefix)
public ValidationResult(List<ValidationInfo> result)
result - root violationsprotected ValidationResult(ValidationInfoFactory infoFactory, boolean dirty, List<ValidationInfo> result)
infoFactory - root info factorydirty - true if provided violations are not sortedresult - root violationsprotected List<ValidationInfo> createResultList(List<ValidationInfo> init)
protected boolean checkDirty()
true if container was just sortedprotected void markDirty()
protected boolean isDirty()
true if container need to be sortedcheckDirty()public int size()
public List<ValidationInfo> getAll()
public ValidationResultSet get(ValidationSeverity severity)
severity - requested severity levelpublic ValidationResultSet getNotConfirmed()
public ValidationResultSet getConfirmed()
public ValidationResultSet getNotConfirmed(ValidationSeverity severity)
severity - requested severity levelprotected boolean pathsMatches(String expected, String actual)
expected - path that is expectedactual - path found in violationtrue if violation path is equal to expected or it's subpathprotected ValidationInfoFactory createWithPrefixFactory(String prefix)
protected ValidationInfoFactory createWithoutPrefixFactory(String prefix)
protected Stream<ValidationInfo> getStream(String path)
public ValidationResultSet get(String prefix)
prefix - violations pathpublic ValidationResultSet find(String path)
path - violations pathprotected Stream<ValidationInfo> getNotConfirmedStream(String path)
public ValidationResultSet getNotConfirmed(String path)
path - violations pathpublic ValidationResultSet findNotConfirmed(String path)
path - violations pathpublic ValidationSeverity getHighestSeverity()
ValidationSeverity.NONE if container is emptypublic ValidationInfo getHighestSeverityInfo()
null if container is emptypublic ValidationSeverity getHighestNotConfirmedSeverity()
ValidationSeverity.NONE if container is emptypublic ValidationInfo getHighestNotConfirmedSeverityInfo()
null if container is emptypublic boolean containsSeverity(ValidationSeverity severity)
severity - violations severitytrue if at least one violation is of specified severitypublic boolean containsNotConfirmedSeverity(ValidationSeverity severity)
severity - violations severitytrue if at least one violation is of specified severity and is not confirmedpublic boolean contains(String path)
path - violations pathtrue if at least one violation is related to provided path or any of its childrenpublic void addValidationInfo(String path, Collection<ValidationInfo> validationInfos)
path - relative path for added violationsvalidationInfos - validation violations to be addedpublic void addValidationInfo(ValidationInfo info)
info - validation violation to be addedprotected void removeImmediately(String path)
public void clear()
public void setValidationInfo(Collection<ValidationInfo> validationInfos)
validationInfos - new violations for containerupdateValidationInfo(Collection)public void setValidationInfo(String path, Collection<ValidationInfo> validationInfos)
As first all violation related to provided path are removed. Then new violations are wrapped with prefix and added to container.
path - root path for added violationsvalidationInfos - validation violations to be addedupdateValidationInfo(String, Collection)public void updateValidationInfo(Collection<ValidationInfo> validationInfos)
As first all violations related to same paths that new ones are removed. Then new violations are added to container.
Notice that only violations related to paths from provided violations are changed, though method does nothing, if provided list is empty.
validationInfos - new violationsremoveValidationInfo(String),
setValidationInfo(Collection)public void updateValidationInfo(String path, Collection<ValidationInfo> validationInfos)
As first all violation related to provided path are removed. Then new violations are added to container. New violations should be related to provided path and define their violation path as a subpath of it.
path - root path which violations are being changedvalidationInfos - new violationsIllegalArgumentException - if any of provided violation defines a path that is not relative to pathremoveValidationInfo(String),
setValidationInfo(String, Collection)public void removeValidationInfo(String path)
path - relative path for which to remove violationspublic void removeValidationInfo(ValidationInfo info)
info - violation to be removedCopyright © 2018. All rights reserved.