@NotThreadSafe public class ErrorList extends Object implements IErrorList, IClearable, ICloneable<ErrorList>
| Constructor and Description |
|---|
ErrorList() |
ErrorList(Collection<? extends IError> aErrorList) |
ErrorList(ErrorList aErrorList) |
ErrorList(IError... aErrorList) |
ErrorList(IErrorList aErrorList) |
| Modifier and Type | Method and Description |
|---|---|
void |
add(IError aItem)
Add a new item.
|
void |
addAll(Collection<? extends IError> aErrorList) |
void |
addAll(IError... aErrorList) |
void |
addAll(IErrorList aErrorList) |
void |
addError(String sText) |
void |
addError(String sFieldName,
String sText) |
void |
addError(String sID,
String sFieldName,
String sText) |
void |
addInfo(String sText) |
void |
addInfo(String sFieldName,
String sText) |
void |
addInfo(String sID,
String sFieldName,
String sText) |
void |
addSuccess(String sText) |
void |
addSuccess(String sFieldName,
String sText) |
void |
addSuccess(String sID,
String sFieldName,
String sText) |
void |
addWarning(String sText) |
void |
addWarning(String sFieldName,
String sText) |
void |
addWarning(String sID,
String sFieldName,
String sText) |
EChange |
clear()
Reset the contents of the element to the after-construction state.
|
boolean |
containsAtLeastOneError()
Check if this group contains at least one error or fatal error message.
|
boolean |
containsAtLeastOneFailure()
Check if this group contains at least one failure message.
|
boolean |
containsAtLeastOneSuccess()
Check if this group contains at least one success message.
|
boolean |
containsNoError()
Check if this group contains no error or fatal error message.
|
boolean |
containsNoFailure()
Check if this group contains no failure message.
|
boolean |
containsNoSuccess()
Check if this group contains no success message.
|
boolean |
containsOnlyError()
Check if this group contains only error or fatal error messages.
|
boolean |
containsOnlyFailure()
Check if this group contains only failure messages.
|
boolean |
containsOnlySuccess()
Check if this group contains only success messages.
|
boolean |
equals(Object o) |
ICommonsList<IError> |
getAllItems() |
ICommonsList<String> |
getAllItemTexts() |
ICommonsList<String> |
getAllItemTextsOfField(String sSearchFieldName)
Get a list with all texts for the specified field name.
|
ICommonsList<String> |
getAllItemTextsOfFields(String... aSearchFieldNames)
Get a list with all texts for the specified field names
|
ICommonsList<String> |
getAllItemTextsOfFieldsRegExp(String sRegEx)
Get a list with all texts of entries that have field names matching the
passed regular expression.
|
ICommonsList<String> |
getAllItemTextsOfFieldsStartingWith(String... aSearchFieldNames)
Get a list with all texts of entries that have field names starting with
one of the supplied names.
|
ErrorList |
getClone() |
int |
getErrorCount() |
int |
getFailureCount() |
int |
getItemCount() |
ErrorList |
getListOfField(String sSearchFieldName)
Get a sub-list with all entries for the specified field name
|
ErrorList |
getListOfFields(String... aSearchFieldNames)
Get a sub-list with all entries for the specified field names
|
ErrorList |
getListOfFieldsRegExp(String sRegExp)
Get a sub-list with all entries that have field names matching the passed
regular expression.
|
ErrorList |
getListOfFieldsStartingWith(String... aSearchFieldNames)
Get a sub-list with all entries that have field names starting with one of
the supplied names.
|
ErrorList |
getListWithoutField() |
IErrorLevel |
getMostSevereErrorLevel()
Get the most severe error level within this object.
|
IMultiMapListBased<String,IError> |
getStructuredByFieldName() |
IMultiMapListBased<String,IError> |
getStructuredByID() |
int |
getSuccessCount() |
boolean |
hasEntryForField(String sSearchFieldName)
Check if any entry for the specified field is present
|
boolean |
hasEntryForField(String sSearchFieldName,
IErrorLevel aErrorLevel)
Check if any entry for the specified field and the specified error level is
present
|
boolean |
hasEntryForFields(String... aSearchFieldNames)
Check if any entry for the specified fields are present
|
boolean |
hasErrorsOrWarnings() |
int |
hashCode() |
boolean |
hasNoEntryForField(String sSearchFieldName)
Check if no entry for the specified field is present
|
boolean |
hasNoEntryForFields(String... aSearchFieldNames)
Check if no entry for the specified fields are present
|
boolean |
isEmpty() |
Iterator<IError> |
iterator() |
EChange |
remove(IError aError) |
EChange |
removeAll(Collection<? extends IError> aErrors) |
EChange |
removeAll(IError... aErrors) |
String |
toString() |
clone, finalize, getClass, notify, notifyAll, wait, wait, waitforEach, spliteratorpublic ErrorList()
public ErrorList(@Nullable IErrorList aErrorList)
public ErrorList(@Nullable Collection<? extends IError> aErrorList)
public final void addAll(@Nullable IErrorList aErrorList)
public final void addAll(@Nullable Collection<? extends IError> aErrorList)
public final void add(@Nonnull IError aItem)
aItem - The item to be added. May not be null.public void addSuccess(@Nullable String sID, @Nullable String sFieldName, @Nonnull @Nonempty String sText)
public void addInfo(@Nullable String sID, @Nullable String sFieldName, @Nonnull @Nonempty String sText)
public void addWarning(@Nullable String sID, @Nullable String sFieldName, @Nonnull @Nonempty String sText)
public void addError(@Nullable String sID, @Nullable String sFieldName, @Nonnull @Nonempty String sText)
public boolean isEmpty()
isEmpty in interface IErrorListtrue if this list has no items, false if
at least one item is contained@Nonnegative public int getItemCount()
getItemCount in interface IErrorListpublic boolean hasErrorsOrWarnings()
hasErrorsOrWarnings in interface IErrorListtrue if at least 1 item of level warning or at least 1
item of level error is contained.public boolean containsOnlySuccess()
IHasErrorLevelsfalse is returned, since no success message is contained. If
you want to check, if the list is empty or contains only success messages,
use IHasErrorLevels.containsNoFailure() instead.containsOnlySuccess in interface IHasErrorLevelstrue if at least one item is present, and if all items
have the error level success, false otherwise.IHasErrorLevels.containsNoFailure()public boolean containsAtLeastOneSuccess()
IHasErrorLevelscontainsAtLeastOneSuccess in interface IHasErrorLevelstrue if at least one success item is present,
false otherwise.public boolean containsNoSuccess()
IHasErrorLevelscontainsNoSuccess in interface IHasErrorLevelstrue if no success item is present, false
otherwise.@Nonnegative public int getSuccessCount()
getSuccessCount in interface IHasErrorLevelspublic boolean containsOnlyFailure()
IHasErrorLevelsfalse is returned. All error levels except
EErrorLevel.SUCCESS are considered to be a failure!containsOnlyFailure in interface IHasErrorLevelstrue if at least one item is present, and if all items
have an error level indicating failure, false
otherwise.public boolean containsAtLeastOneFailure()
IHasErrorLevelsEErrorLevel.SUCCESS are considered to be a failure!containsAtLeastOneFailure in interface IHasErrorLevelstrue if at least one failure item is present,
false otherwise.public boolean containsNoFailure()
IHasErrorLevelsEErrorLevel.SUCCESS are considered to be a failure!containsNoFailure in interface IHasErrorLevelstrue if no failure item is present, false
otherwise.@Nonnegative public int getFailureCount()
getFailureCount in interface IHasErrorLevelspublic boolean containsOnlyError()
IHasErrorLevelsfalse is returned. All error levels ≥
EErrorLevel.ERROR are considered to be an error!containsOnlyError in interface IHasErrorLevelstrue if at least one item is present, and if all items
have an error level indicating error or fatal error,
false otherwise.public boolean containsAtLeastOneError()
IHasErrorLevelsEErrorLevel.ERROR are considered to be an error!containsAtLeastOneError in interface IHasErrorLevelstrue if at least one error or fatal error item is
present, false otherwise.public boolean containsNoError()
IHasErrorLevelsEErrorLevel.ERROR are considered to be an error!containsNoError in interface IHasErrorLevelstrue if no error or fatal error item is present,
false otherwise.@Nonnegative public int getErrorCount()
getErrorCount in interface IHasErrorLevelsEErrorLevel.ERROR are considered to be an
error!@Nonnull public IErrorLevel getMostSevereErrorLevel()
IHasErrorLevelsEErrorLevel's severity model.getMostSevereErrorLevel in interface IHasErrorLevelsEErrorLevel.SUCCESS if no resource error is contained, the
most severe contained error level otherwise.@Nonnull @ReturnsMutableCopy public ICommonsList<String> getAllItemTexts()
getAllItemTexts in interface IErrorListnull list of all contained texts, independent of
the level.@Nonnull @ReturnsMutableCopy public ICommonsList<IError> getAllItems()
getAllItems in interface IErrorListnull.@Nonnull @ReturnsMutableCopy public ErrorList getListWithoutField()
getListWithoutField in interface IErrorListpublic boolean hasNoEntryForField(@Nullable String sSearchFieldName)
IFieldErrorListhasNoEntryForField in interface IFieldErrorListsSearchFieldName - The field name to search.true if no entry for the specified field is presentpublic boolean hasNoEntryForFields(@Nullable String... aSearchFieldNames)
IFieldErrorListhasNoEntryForFields in interface IFieldErrorListaSearchFieldNames - The field names to search.true if no entry for any of the specified fields is
presentpublic boolean hasEntryForField(@Nullable String sSearchFieldName)
IFieldErrorListhasEntryForField in interface IFieldErrorListsSearchFieldName - The field name to search.true if an entry for the specified field is presentpublic boolean hasEntryForField(@Nullable String sSearchFieldName, @Nullable IErrorLevel aErrorLevel)
IFieldErrorListhasEntryForField in interface IFieldErrorListsSearchFieldName - The field name to search.aErrorLevel - The exact form error level to search. May not be nulltrue if an entry for the specified field is present
that has exactly the specified form error levelpublic boolean hasEntryForFields(@Nullable String... aSearchFieldNames)
IFieldErrorListhasEntryForFields in interface IFieldErrorListaSearchFieldNames - The field names to search.true if an entry for at least one of the specified
fields is present@Nonnull @ReturnsMutableCopy public ErrorList getListOfField(@Nullable String sSearchFieldName)
IFieldErrorListgetListOfField in interface IFieldErrorListsSearchFieldName - The field name to search.null.@Nonnull @ReturnsMutableCopy public ErrorList getListOfFields(@Nullable String... aSearchFieldNames)
IFieldErrorListgetListOfFields in interface IFieldErrorListaSearchFieldNames - The field names to search.null.@Nonnull @ReturnsMutableCopy public ErrorList getListOfFieldsStartingWith(@Nullable String... aSearchFieldNames)
IFieldErrorListgetListOfFieldsStartingWith in interface IFieldErrorListaSearchFieldNames - The field names to search.null.@Nonnull @ReturnsMutableCopy public ErrorList getListOfFieldsRegExp(@Nonnull @Nonempty @RegEx String sRegExp)
IFieldErrorListgetListOfFieldsRegExp in interface IFieldErrorListsRegExp - The regular expression to compare the entries against.null.@Nonnull @ReturnsMutableCopy public ICommonsList<String> getAllItemTextsOfField(@Nullable String sSearchFieldName)
IFieldErrorListgetAllItemTextsOfField in interface IFieldErrorListsSearchFieldName - The field name to search.null.@Nonnull @ReturnsMutableCopy public ICommonsList<String> getAllItemTextsOfFields(@Nullable String... aSearchFieldNames)
IFieldErrorListgetAllItemTextsOfFields in interface IFieldErrorListaSearchFieldNames - The field names to search.null.@Nonnull @ReturnsMutableCopy public ICommonsList<String> getAllItemTextsOfFieldsStartingWith(@Nullable String... aSearchFieldNames)
IFieldErrorListgetAllItemTextsOfFieldsStartingWith in interface IFieldErrorListaSearchFieldNames - The field names to search.null.@Nonnull @ReturnsMutableCopy public ICommonsList<String> getAllItemTextsOfFieldsRegExp(@Nonnull @Nonempty @RegEx String sRegEx)
IFieldErrorListgetAllItemTextsOfFieldsRegExp in interface IFieldErrorListsRegEx - The regular expression to compare the entries against.null.@Nonnull @ReturnsMutableCopy public IMultiMapListBased<String,IError> getStructuredByID()
getStructuredByID in interface IFieldErrorList@Nonnull @ReturnsMutableCopy public IMultiMapListBased<String,IError> getStructuredByFieldName()
getStructuredByFieldName in interface IFieldErrorList@Nonnull public EChange removeAll(@Nullable Collection<? extends IError> aErrors)
@Nonnull public EChange clear()
IClearableclear in interface IClearableEChange.CHANGED if at least one element was cleared,
EChange.UNCHANGED otherwise.@Nonnull public ErrorList getClone()
getClone in interface ICloneable<ErrorList>Copyright © 2014–2016 Philip Helger. All rights reserved.