java.lang.Object
com.aquima.interactions.foundation.report.ErrorCode
All Implemented Interfaces:
Serializable, Comparable<ErrorCode>
Direct Known Subclasses:
ContentErrorCode, ElementErrorCode, RuleErrorCode, TypedErrorCode, UntypedErrorCode

public abstract class ErrorCode extends Object implements Serializable, Comparable<ErrorCode>
This class identified an error.
Since:
5.0
Author:
F. van der Meer, Jon van Leuven, O. Kerpershoek
See Also:
  • Constructor Details

    • ErrorCode

      public ErrorCode(String code, String englishText, String[] parameterNames)
      Constructs an error definition with a code which should be unique and a default English text. The English text allows parameters which can be inserted. Example:
       
       new ErrorCode( "myuniqueId", "The message came from {0}" );
       
       
      Parameters:
      code - Unique code for the error.
      englishText - An explanation text for the error, optionally containing parameters.
      parameterNames - Array of strings containing the names of the parameters.
  • Method Details

    • getElementType

      protected abstract String getElementType(Map<String,String> blamedElements)
    • getElementName

      protected abstract String getElementName(Map<String,String> blamedElements)
    • isTyped

      protected boolean isTyped(Map<String,String> blamedElements)
    • getCode

      public String getCode()
      This method returns the unique error code ID of this object.
      Returns:
      the unique error code ID of this object.
    • getEnglishText

      public String getEnglishText(String[] parameters)
      This method returns the error message text with the provided parameters substituted in the message.
      Parameters:
      parameters - The parameter values that should be used in the error message.
      Returns:
      the error message text with the provided parameters substituted in the message.
    • getInternalText

      public String getInternalText()
      This method returns the error message text without any parameter substitution.
      Returns:
      the error message text without any parameter substitution.
    • getParameterCount

      public int getParameterCount()
      This method returns the number of parameters that should be supplied.
      Returns:
      the number of parameters that should be supplied.
    • getParameterNames

      public String[] getParameterNames()
      This method returns the names of the parameters that should be provided for the error message.
      Returns:
      the names of the parameters that should be provided for the error message.
    • compareTo

      public int compareTo(ErrorCode o)
      Specified by:
      compareTo in interface Comparable<ErrorCode>
    • equals

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

      public int hashCode()
      Overrides:
      hashCode in class Object
    • toString

      public String toString()
      Overrides:
      toString in class Object
    • createWith

      public ErrorMessage createWith(String[] parameters)
      This method creates and returns the message for this code with an array parameters.
      Parameters:
      parameters - Array containing the values for the parameters.
      Returns:
      the message for this code with an array parameters.
    • createWith

      public ErrorMessage createWith(Object parameter1)
      This method creates and returns the message for this code with a single parameter.
      Parameters:
      parameter1 - The parameter that should be substituted in the message.
      Returns:
      the message for this code.
    • createWith

      public ErrorMessage createWith(Object parameter1, Object parameter2)
      This method creates and returns the message for this code with two parameter.
      Parameters:
      parameter1 - The first parameter that should be substituted in the message.
      parameter2 - The second parameter that should be substituted in the message.
      Returns:
      the message for this code.
    • createWith

      public ErrorMessage createWith(Object parameter1, Object parameter2, Object parameter3)
      This method creates and returns the message for this code with three parameter.
      Parameters:
      parameter1 - The first parameter that should be substituted in the message.
      parameter2 - The second parameter that should be substituted in the message.
      parameter3 - The third parameter that should be substituted in the message.
      Returns:
      the message for this code.
    • create

      public ErrorMessage create()
      This method creates and returns the message for this code without any parameters.
      Returns:
      the message for this code without any parameters.