Class MessagesPerFieldBean

java.lang.Object
org.keycloak.theme.beans.MessagesPerFieldBean

public class MessagesPerFieldBean extends Object
Bean used to hold form messages per field. Stored under messagesPerField key in Freemarker context.
Author:
Vlastimil Elias (velias at redhat dot com)
  • Constructor Details

    • MessagesPerFieldBean

      public MessagesPerFieldBean()
  • Method Details

    • addMessage

      public void addMessage(String field, String messageText, MessageType messageType)
    • exists

      public boolean exists(String field)
      Check if message for given field exists
      Parameters:
      field -
      Returns:
    • existsError

      public boolean existsError(String... fields)
      Check if exists error message for given fields
      Parameters:
      fields -
      Returns:
    • getFirstError

      public String getFirstError(String... fields)
      Get first error message for given fields
      Parameters:
      fields -
      Returns:
      message text or empty string
    • get

      public String get(String fieldName)
      Get message for given field.
      Parameters:
      fieldName -
      Returns:
      message text or empty string
    • printIfExists

      public String printIfExists(String fieldName, String text)
      Print text if message for given field exists. Useful eg. to add css styles for fields with message.
      Parameters:
      fieldName - to check for
      text - to print
      Returns:
      text if message exists for given field, else empty string