接口 MessageSourceResolvable
- 函数接口:
- 这是一个函数接口, 因此可用作 lambda 表达式或方法引用的赋值目标。
@FunctionalInterface public interface MessageSourceResolvable
Interface for objects that are suitable for message resolution in aMessageSource
.Spring's own validation error classes implement this interface.
- 作者:
- Juergen Hoeller
- 另请参阅:
MessageSource.getMessage(MessageSourceResolvable, java.util.Locale)
,ObjectError
,FieldError
方法概要
所有方法 实例方法 抽象方法 默认方法 修饰符和类型 方法 说明 default Object[]
getArguments()
Return the array of arguments to be used to resolve this message.String[]
getCodes()
Return the codes to be used to resolve this message, in the order that they should get tried.default String
getDefaultMessage()
Return the default message to be used to resolve this message.
方法详细资料
getCodes
@Nullable String[] getCodes()
Return the codes to be used to resolve this message, in the order that they should get tried. The last code will therefore be the default one.- 返回:
- a String array of codes which are associated with this message
getArguments
@Nullable default Object[] getArguments()
Return the array of arguments to be used to resolve this message.The default implementation simply returns
null
.- 返回:
- an array of objects to be used as parameters to replace placeholders within the message text
- 另请参阅:
MessageFormat
getDefaultMessage
@Nullable default String getDefaultMessage()
Return the default message to be used to resolve this message.The default implementation simply returns
null
. Note that the default message may be identical to the primary message code (getCodes()
), which effectively enforcesAbstractMessageSource.setUseCodeAsDefaultMessage(boolean)
for this particular message.- 返回:
- the default message, or
null
if no default