Enum Class MessageParameterEscaping

java.lang.Object
java.lang.Enum<MessageParameterEscaping>
org.hibernate.validator.messageinterpolation.MessageParameterEscaping
All Implemented Interfaces:
Serializable, Comparable<MessageParameterEscaping>, Constable

@Incubating public enum MessageParameterEscaping extends Enum<MessageParameterEscaping>
Defines whether message parameters should be escaped to prevent injection into message interpolation expressions.
Since:
9.1
  • Enum Constant Details

    • ESCAPE

      public static final MessageParameterEscaping ESCAPE
      Message parameter values are escaped before being stored.

      This is the default behavior. The value is converted to its string representation and characters that have special meaning in message interpolation (\, {, }, $) are escaped to prevent injection.

    • NONE

      public static final MessageParameterEscaping NONE
      Message parameter values are stored as-is, without any escaping.

      Use this when the value is already escaped or when you are certain it does not contain characters that could be interpreted during message interpolation. Or when the value can and will be interpolated, but that is your intention to do so.

  • Method Details

    • values

      public static MessageParameterEscaping[] values()
      Returns an array containing the constants of this enum class, in the order they are declared.
      Returns:
      an array containing the constants of this enum class, in the order they are declared
    • valueOf

      public static MessageParameterEscaping valueOf(String name)
      Returns the enum constant of this class with the specified name. The string must match exactly an identifier used to declare an enum constant in this class. (Extraneous whitespace characters are not permitted.)
      Parameters:
      name - the name of the enum constant to be returned.
      Returns:
      the enum constant with the specified name
      Throws:
      IllegalArgumentException - if this enum class has no constant with the specified name
      NullPointerException - if the argument is null
    • apply

      public abstract Object apply(Object value)
    • of

      public static MessageParameterEscaping of(String value)