org.keycloak.theme.beans

## 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 Summary

    Constructors
    Constructor and Description
    `MessagesPerFieldBean()`

  - ### Method Summary

    All Methods Instance Methods Concrete Methods
    Modifier and Type | Method and Description
    --- | ---
    `void` | `addMessage(String field, String messageText, MessageType messageType)`
    `boolean` | `exists(String field)` Check if message for given field exists
    `String` | `get(String fieldName)` Get message for given field.
    `String` | `printIfExists(String fieldName, String text)` Print text if message for given field exists.

    - ### Methods inherited from class java.lang.Object

      `clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

- - ### Constructor Detail

    - #### MessagesPerFieldBean

          public MessagesPerFieldBean()

  - ### Method Detail

    - #### 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:

    - #### 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

Copyright © 2016 JBoss by Red Hat. All rights reserved.