Class LocaleFormatter
java.lang.Object
com.appiancorp.suiteapi.common.exceptions.LocaleFormatter
- All Implemented Interfaces:
AppianErrorCodeStaticMessageFormatter,AppianErrorCodeTitleFormatter,AppianErrorCodeFormatter
public class LocaleFormatter
extends Object
implements AppianErrorCodeFormatter, AppianErrorCodeTitleFormatter, AppianErrorCodeStaticMessageFormatter
ErrorCodeFormatter based upon a Locale.
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionformat(AppianErrorCode errorCode, Object... arguments) formatStaticMessage(AppianErrorCode errorCode) Returns the localized static message if it exists.formatTitle(AppianErrorCode errorCode, Object... arguments) Returns the localized title, rendered with the included arguments if the error title supports them.getStaticMessageFromErrorCode(String errorCode) Returns the localized static message for a given error code string This method should NOT be used for strings that don't correspond to an ErrorCode (i.e. this will not work on ValidationCode)static Stringstatic StringManually fetch error code text Useful in case that the locale is not available in context and error code is not automatically converted to correct locale text
-
Constructor Details
-
LocaleFormatter
-
-
Method Details
-
format
- Specified by:
formatin interfaceAppianErrorCodeFormatter
-
formatTitle
Returns the localized title, rendered with the included arguments if the error title supports them. If the title does not exist, the method returns "".- Specified by:
formatTitlein interfaceAppianErrorCodeTitleFormatter- Parameters:
errorCode- The code corresponding to the thrown exceptionarguments- Additional parameters required to render the title- Returns:
- The title, localized and rendered with the included arguments where applicable.
-
formatStaticMessage
Returns the localized static message if it exists. Note that currently only ErrorCode objects have staticMessage set- Specified by:
formatStaticMessagein interfaceAppianErrorCodeStaticMessageFormatter- Parameters:
errorCode- The code corresponding to the thrown exception- Returns:
- The static message, localized.
-
getStaticMessageFromErrorCode
Returns the localized static message for a given error code string This method should NOT be used for strings that don't correspond to an ErrorCode (i.e. this will not work on ValidationCode)- Specified by:
getStaticMessageFromErrorCodein interfaceAppianErrorCodeStaticMessageFormatter- Parameters:
errorCode- string representation of an error code (should be equivalent to ErrorCode#toString)- Returns:
- the localized static message for that error code
-
getText
Manually fetch error code text Useful in case that the locale is not available in context and error code is not automatically converted to correct locale text -
getText
-