Package nz.org.riskscape.engine.i18n
Class RiskscapeMessage
java.lang.Object
nz.org.riskscape.engine.i18n.RiskscapeMessage
- All Implemented Interfaces:
MessageKey
-
Field Summary
Fields inherited from interface nz.org.riskscape.engine.i18n.MessageKey
NO_ARGS
-
Method Summary
Modifier and TypeMethodDescriptionprotected boolean
boolean
getCode()
Return the code that identifies this message inResourceBundle
lookups.Return the default message to be used to resolve this message should lookups of 'code' fail to find a message.Object[]
Return the array of arguments to be used to resolve this message.int
hashCode()
static RiskscapeMessage
Build aRiskscapeMessage
with desired code and messageArguments.static RiskscapeMessage
Build aRiskscapeMessage
that only contains the default message.static RiskscapeMessage
withDefault
(@NonNull String code, @NonNull String defaultMessage, Object... arguments) Build aRiskscapeMessage
with desired code and messageArguments.
-
Method Details
-
of
Build a
RiskscapeMessage
with desired code and messageArguments.- Parameters:
code
-arguments
-- Returns:
- RiskscapeMessage with desired code and messageArguments
-
withDefault
public static RiskscapeMessage withDefault(@NonNull @NonNull String code, @NonNull @NonNull String defaultMessage, Object... arguments) Build a
RiskscapeMessage
with desired code and messageArguments.- Parameters:
code
-defaultMessage
-arguments
-- Returns:
- RiskscapeMessage with default code and messageArguments
-
ofDefault
Build a
RiskscapeMessage
that only contains the default message.Useful when API's require a
RiskscapeMessage
to be used but there are no reasonable codes to use. Such as when the message actually comes from user provided sources. -
equals
-
canEqual
-
hashCode
public int hashCode() -
getCode
Description copied from interface:MessageKey
Return the code that identifies this message in
ResourceBundle
lookups.- Specified by:
getCode
in interfaceMessageKey
-
getMessageArguments
Description copied from interface:MessageKey
Return the array of arguments to be used to resolve this message.
The default implementation simply returns null.
- Specified by:
getMessageArguments
in interfaceMessageKey
- Returns:
- an array of objects to be used as parameters to replace placeholders within the message text
-
getDefaultMessage
Description copied from interface:MessageKey
Return the default message to be used to resolve this message should lookups of 'code' fail to find a message.
- Specified by:
getDefaultMessage
in interfaceMessageKey
- Returns:
- the default message, or null if no default
-