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 ofIErrorTextProviderwith a customizable layout.- Since:
- 8.5.1
- Author:
- Philip Helger
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static classErrorTextProvider.EFieldstatic classErrorTextProvider.FormattableItemDefault placeholder based implementation ofErrorTextProvider.IFormattableItem.static interfaceErrorTextProvider.IFormattableItemBase interface for objects that format a single field.
-
Field Summary
Fields Modifier and Type Field Description static IErrorTextProviderDEFAULTstatic charPLACEHOLDERstatic StringPLACEHOLDER_STR
-
Constructor Summary
Constructors Constructor Description ErrorTextProvider()ErrorTextProvider(ErrorTextProvider aOther)Copy constructor.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description ErrorTextProvideraddItem(ErrorTextProvider.EField eField, String sText)Add an error item to be disabled.ErrorTextProvideraddItem(ErrorTextProvider.IFormattableItem aItem)ICommonsList<ErrorTextProvider.IFormattableItem>getAllItems()ErrorTextProvidergetClone()StringgetErrorText(IError aError, Locale aContentLocale)Get the provided error as a StringStringgetFieldSeparator()ErrorTextProvidersetFieldSeparator(String sFieldSep)StringtoString()
-
-
-
Field Detail
-
PLACEHOLDER
public static final char PLACEHOLDER
- See Also:
- Constant Field Values
-
PLACEHOLDER_STR
public static final String PLACEHOLDER_STR
-
DEFAULT
public static final IErrorTextProvider DEFAULT
-
-
Constructor Detail
-
ErrorTextProvider
public ErrorTextProvider()
-
ErrorTextProvider
public ErrorTextProvider(@Nonnull ErrorTextProvider aOther)
Copy constructor.- Parameters:
aOther- Object to copy from. May not benull.- Since:
- 8.5.5
-
-
Method Detail
-
getAllItems
@Nonnull @ReturnsMutableCopy public ICommonsList<ErrorTextProvider.IFormattableItem> 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 (36) that will be replaced- Returns:
- this for chaining
-
addItem
@Nonnull public ErrorTextProvider addItem(@Nonnull ErrorTextProvider.IFormattableItem aItem)
-
setFieldSeparator
@Nonnull public ErrorTextProvider setFieldSeparator(@Nonnull String sFieldSep)
-
getErrorText
@Nonnull public String getErrorText(@Nonnull IError aError, @Nonnull Locale aContentLocale)
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
@Nonnull @ReturnsMutableCopy public ErrorTextProvider getClone()
- Specified by:
getClonein interfaceICloneable<ErrorTextProvider>- Returns:
- A 100% deep-copy of the implementing class.
-
-