Class ErrorType

java.lang.Object
org.apache.empire.commons.ErrorType

public class ErrorType extends Object
The ErrorType class defines a type of error. In order to define an error you need to provide an ErrorKey and a MessagePattern.

The ErrorKey is a unique identifier for the error that may also be used as a translation key The ErrorKey should always start with the "error." prefix.

The MessagePattern is a template containing the error message and placeholders for additional parameters. The MessagePattern must be formated according to the MessageFormat rules.

  • Constructor Details

    • ErrorType

      public ErrorType(String errorKey, String msgPattern)
      Defines an error type.
      Parameters:
      errorKey - the error key string (can be used for internationalization)
      msgPattern - message pattern in english language used e.g. for logging
  • Method Details

    • getKey

      public String getKey()
      Returns the error type key (might be used for internationalization).
      Returns:
      the error type key
    • getMessagePattern

      public String getMessagePattern()
      Returns the message pattern.
      Returns:
      the message pattern
    • getNumParams

      public int getNumParams()
      Returns the number of parameters required for the message pattern.
      Returns:
      the number of parameters required for the message pattern