Class ValidationItem

java.lang.Object
com.appiancorp.suiteapi.common.ValidationItem

public class ValidationItem extends Object
A ValidationItem associates a ValidationCode to the the supplied parameters. A call to getMessage(Locale) returns the message associated with the ValidationCode passing the parameters to the ValidationCode#getMessage(Locale, Object[]) method. ValidationItems are to ValidationCodes what ErrorCodes are to AppianExceptions (a transport mechanism for AppianErrorCode)
  • Constructor Details

  • Method Details

    • getValidationCode

      public ValidationCode getValidationCode()
      Gets the validation code that must be used to render this validation items's message representation.
      Returns:
      the validation code tied to this validation item
    • getValidationCodeParams

      public Object[] getValidationCodeParams()
      Gets the arguments that must be used to render this validation items's message representation.
      Returns:
      the arguments of the validation code tied to this validation item
    • getMessage

      public String getMessage(Locale locale)
      Returns this validation items's message representation. This method should be used whenever the message is to be displayed to the end user. The default representation do not include any validation code information because this may be rendered in different ways across the application. If needed, the validation items's validation code can be retrieved from getValidationCode().
      Parameters:
      locale - message's locale
      Returns:
      this validation item's message representation
      See Also:
    • getMessageWithValidationCode

      public String getMessageWithValidationCode(Locale locale)
      Returns this validation items's default message representation with validation code information. This method could be used whenever the message is to be displayed to the end user. Although the default representation getMessage(Locale) does not include any error code information, as the representation could vary in different ways across the application, this method provides a utility for a representation with validation code. Be sure while using this method as the requirements could vary, in which case use getMessage(Locale) in conjunction with getValidationCode().
      Parameters:
      locale - message's locale
      Returns:
      this validation items's default message representation with validation code
      See Also:
    • toString

      public String toString()
      Could be used for logging
      Overrides:
      toString in class Object
    • equals

      public boolean equals(Object obj_)
      Overrides:
      equals in class Object
    • hashCode

      public int hashCode()
      Overrides:
      hashCode in class Object