Package com.helger.commons.error
Class ErrorTextProvider
java.lang.Object
com.helger.commons.error.ErrorTextProvider
- All Implemented Interfaces:
IErrorTextProvider,ICloneable<ErrorTextProvider>
@NotThreadSafe
public class ErrorTextProvider
extends Object
implements IErrorTextProvider, ICloneable<ErrorTextProvider>
Default implementation of
IErrorTextProvider with a customizable
layout.- Since:
- 8.5.1
- Author:
- Philip Helger
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic enumstatic classDefault placeholder based implementation ofErrorTextProvider.IFormattableItem.static interfaceBase interface for objects that format a single field. -
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final IErrorTextProviderstatic final charstatic final String -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionaddItem(ErrorTextProvider.EField eField, String sText) Add an error item to be disabled.getClone()getErrorText(IError aError, Locale aContentLocale) Get the provided error as a StringsetFieldSeparator(String sFieldSep) toString()
-
Field Details
-
PLACEHOLDER
public static final char PLACEHOLDER- See Also:
-
PLACEHOLDER_STR
-
DEFAULT
-
-
Constructor Details
-
ErrorTextProvider
public ErrorTextProvider() -
ErrorTextProvider
Copy constructor.- Parameters:
aOther- Object to copy from. May not benull.- Since:
- 8.5.5
-
-
Method Details
-
getAllItems
-
addItem
@Nonnull public ErrorTextProvider addItem(@Nonnull ErrorTextProvider.EField eField, @Nonnull @Nonempty String sText) Add an error item to be disabled.- Parameters:
eField- The field to be used. May not benull.sText- The text that should contain the placeholder ('$') that will be replaced- Returns:
- this for chaining
-
addItem
-
getFieldSeparator
-
setFieldSeparator
-
getErrorText
Description copied from interface:IErrorTextProviderGet the provided error as a String- Specified by:
getErrorTextin interfaceIErrorTextProvider- Parameters:
aError- The error to be converted. May not benull.aContentLocale- The content locale to be used. May not benull.- Returns:
- A non-
nullString.
-
getClone
- Specified by:
getClonein interfaceICloneable<ErrorTextProvider>- Returns:
- A 100% deep-copy of the implementing class.
-
toString
-