接口 MessageSourceResolvable

所有已知实现类:
DefaultMessageSourceResolvable, FieldError, ObjectError
函数接口:
这是一个函数接口, 因此可用作 lambda 表达式或方法引用的赋值目标。

@FunctionalInterface public interface MessageSourceResolvable
Interface for objects that are suitable for message resolution in a MessageSource.

Framework's own validation error classes implement this interface.

作者:
Juergen Hoeller
另请参阅:
  • 方法概要

    修饰符和类型
    方法
    说明
    default Object[]
    Return the array of arguments to be used to resolve this message.
    Return the codes to be used to resolve this message, in the order that they should get tried.
    default String
    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
      另请参阅:
    • 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 enforces AbstractMessageSource.setUseCodeAsDefaultMessage(boolean) for this particular message.

      返回:
      the default message, or null if no default