@NotThreadSafe public class FormErrors extends Object implements Serializable, IFieldErrorList
| Constructor and Description |
|---|
FormErrors() |
| Modifier and Type | Method and Description |
|---|---|
void |
addAll(FormErrors aOther) |
void |
addFieldError(String sFieldName,
String sText)
Add a field specific error message.
|
void |
addFieldInfo(String sFieldName,
String sText)
Add a field specific information message.
|
void |
addFieldItem(IError aFormFieldError)
Add a form field specific item
|
void |
addFieldWarning(String sFieldName,
String sText)
Add a field specific warning message.
|
void |
addGlobalError(String sText)
Add a form-global error
|
void |
addGlobalInfo(String sText)
Add a form-global information
|
void |
addGlobalItem(IError aFormError)
Add a form-global item
|
void |
addGlobalWarning(String sText)
Add a form-global warning
|
EChange |
clear() |
boolean |
equals(Object o) |
List<IError> |
getAllFieldItems() |
List<String> |
getAllFieldItemTexts() |
List<IError> |
getAllGlobalItems() |
List<String> |
getAllGlobalItemTexts() |
List<String> |
getAllItemTextsOfField(String sSearchFieldName)
Get a list with all texts for the specified field name.
|
List<String> |
getAllItemTextsOfFields(String... aSearchFieldNames)
Get a list with all texts for the specified field names
|
List<String> |
getAllItemTextsOfFieldsRegExp(String sRegExp)
Get a list with all texts of entries that have field names matching the
passed regular expression.
|
List<String> |
getAllItemTextsOfFieldsStartingWith(String... aSearchFieldNames)
Get a list with all texts of entries that have field names starting with
one of the supplied names.
|
int |
getFieldItemCount() |
int |
getGlobalItemCount() |
int |
getItemCount()
Get the total number of items for both form-global and form-field-specific
items
|
IErrorList |
getListOfField(String sSearchFieldName)
Get a sub-list with all entries for the specified field name
|
IErrorList |
getListOfFields(String... aSearchFieldNames)
Get a sub-list with all entries for the specified field names
|
IErrorList |
getListOfFieldsRegExp(String sRegExp)
Get a sub-list with all entries that have field names matching the passed
regular expression.
|
IErrorList |
getListOfFieldsStartingWith(String... aSearchFieldNames)
Get a sub-list with all entries that have field names starting with one of
the supplied names.
|
IErrorLevel |
getMostSevereErrorLevel()
Get the most severe error level that was recorded.
|
IMultiMapListBased<String,IError> |
getStructuredByFieldName() |
IMultiMapListBased<String,IError> |
getStructuredByID() |
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... aSearchFieldName)
Check if any entry for the specified fields are present
|
boolean |
hasErrorForField(String sSearchFieldName) |
boolean |
hasErrorsOrWarnings() |
boolean |
hasFormFieldErrorsOrWarnings() |
boolean |
hasGlobalErrorsOrWarnings() |
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()
Check if no message is contained overall.
|
String |
toString() |
public void addAll(@Nullable FormErrors aOther)
public void addGlobalItem(@Nonnull IError aFormError)
aFormError - The form error object to add. May not be null.public void addGlobalInfo(@Nonnull @Nonempty String sText)
sText - The text to use. May neither be null nor empty.public void addGlobalWarning(@Nonnull @Nonempty String sText)
sText - The text to use. May neither be null nor empty.public void addGlobalError(@Nonnull @Nonempty String sText)
sText - The text to use. May neither be null nor empty.public void addFieldItem(@Nonnull IError aFormFieldError)
aFormFieldError - The form field error object to add. May not be null.public void addFieldInfo(@Nonnull @Nonempty String sFieldName, @Nonnull @Nonempty String sText)
sFieldName - The field name for which the message is to be recorded. May neither
be null nor empty.sText - The text to use. May neither be null nor empty.public void addFieldWarning(@Nonnull @Nonempty String sFieldName, @Nonnull @Nonempty String sText)
sFieldName - The field name for which the message is to be recorded. May neither
be null nor empty.sText - The text to use. May neither be null nor empty.public void addFieldError(@Nonnull @Nonempty String sFieldName, @Nonnull @Nonempty String sText)
sFieldName - The field name for which the message is to be recorded. May neither
be null nor empty.sText - The text to use. May neither be null nor empty.public boolean isEmpty()
true if neither a form-global nor a form-field
specific message is present, false otherwise.public boolean hasGlobalErrorsOrWarnings()
true if form-global errors or warnings are present.public boolean hasFormFieldErrorsOrWarnings()
true if form-field errors or warnings are present.public boolean hasErrorsOrWarnings()
true if form-global OR form-field errors or warnings
are present.@Nonnegative public int getGlobalItemCount()
@Nonnegative public int getFieldItemCount()
@Nonnegative public int getItemCount()
@Nonnull public IErrorLevel getMostSevereErrorLevel()
null.@Nonnull @ReturnsMutableCopy public List<IError> getAllGlobalItems()
null list of form global errors.@Nonnull @ReturnsMutableCopy public List<String> getAllGlobalItemTexts()
null list of all form global error texts.public 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 hasEntryForFields(@Nullable String... aSearchFieldName)
IFieldErrorListhasEntryForFields in interface IFieldErrorListaSearchFieldName - The field names to search.true if an entry for at least one of the specified
fields 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 level@Nonnull @ReturnsMutableCopy public IErrorList getListOfField(@Nullable String sSearchFieldName)
IFieldErrorListgetListOfField in interface IFieldErrorListsSearchFieldName - The field name to search.null.@Nonnull @ReturnsMutableCopy public IErrorList getListOfFields(@Nullable String... aSearchFieldNames)
IFieldErrorListgetListOfFields in interface IFieldErrorListaSearchFieldNames - The field names to search.null.@Nonnull @ReturnsMutableCopy public IErrorList getListOfFieldsStartingWith(@Nullable String... aSearchFieldNames)
IFieldErrorListgetListOfFieldsStartingWith in interface IFieldErrorListaSearchFieldNames - The field names to search.null.@Nonnull @ReturnsMutableCopy public IErrorList getListOfFieldsRegExp(@Nonnull @Nonempty @RegEx String sRegExp)
IFieldErrorListgetListOfFieldsRegExp in interface IFieldErrorListsRegExp - The regular expression to compare the entries against.null.@Nonnull @ReturnsMutableCopy public List<String> getAllItemTextsOfField(@Nullable String sSearchFieldName)
IFieldErrorListgetAllItemTextsOfField in interface IFieldErrorListsSearchFieldName - The field name to search.null.@Nonnull @ReturnsMutableCopy public List<String> getAllItemTextsOfFields(@Nullable String... aSearchFieldNames)
IFieldErrorListgetAllItemTextsOfFields in interface IFieldErrorListaSearchFieldNames - The field names to search.null.@Nonnull @ReturnsMutableCopy public List<String> getAllItemTextsOfFieldsStartingWith(@Nullable String... aSearchFieldNames)
IFieldErrorListgetAllItemTextsOfFieldsStartingWith in interface IFieldErrorListaSearchFieldNames - The field names to search.null.@Nonnull @ReturnsMutableCopy public List<String> getAllItemTextsOfFieldsRegExp(@Nonnull @Nonempty @RegEx String sRegExp)
IFieldErrorListgetAllItemTextsOfFieldsRegExp in interface IFieldErrorListsRegExp - The regular expression to compare the entries against.null.@Nonnull @ReturnsMutableCopy public List<IError> getAllFieldItems()
@Nonnull @ReturnsMutableCopy public List<String> getAllFieldItemTexts()
@Nonnull @ReturnsMutableCopy public IMultiMapListBased<String,IError> getStructuredByFieldName()
getStructuredByFieldName in interface IFieldErrorList@Nonnull @ReturnsMutableCopy public IMultiMapListBased<String,IError> getStructuredByID()
getStructuredByID in interface IFieldErrorListCopyright © 2014–2016 Philip Helger. All rights reserved.