Class ErrorCode

java.lang.Object
com.motivewave.platform.sdk.common.ErrorCode
All Implemented Interfaces:
Serializable, Comparable

public class ErrorCode extends Object implements Comparable, Serializable
Encapsulates a message ID and the resource bundle used to resolve the locale dependent message.
See Also:
  • Constructor Details

    • ErrorCode

      public ErrorCode(String ID, String rb)
      Constructs an error message with the given bundle name.
      Parameters:
      ID - error id
      rb - resource bundle name
  • Method Details

    • compareTo

      public int compareTo(Object o)
      Warning: this method does not support localization.
      Specified by:
      compareTo in interface Comparable
      Parameters:
      o - object to compare to
      Returns:
      result of the comparison between this string, and the input, according to the default locale.
    • equals

      public boolean equals(Object obj)
      Compares this object with another ErrorMsg.
      Overrides:
      equals in class Object
      Parameters:
      obj - The other object to compare with this one.
      Returns:
      true if the this object is equal to obj.
    • get

      public String get(Locale locale, Object... params)
      Gets the locale dependent message for the default locale. The occurences of %x are replace by the given parameters. If one of the paramaters is a MsgID, it will be localized (using get(Locale, Object...) before using it as the argument to the current message.
      Parameters:
      locale - The locale for this message.
      params - An array of parameters for the message.
      Returns:
      The message.
    • get

      public String get()
      Gets the locale dependent message using the US locale
      Returns:
      the local dependent message
    • get

      public String get(Object... params)
      Gets the locale dependent message using the US locale (with the given string substitutions)
      Parameters:
      params - parameter substitutions for {0}, {1} etc
      Returns:
      the local dependent message
    • write

      public final void write(Writer out, Locale locale, Object... params) throws IOException
      Convenience method. Gets the locale dependent message for the default locale. The occurrences of {x} are replace by the given parameters.
      Parameters:
      out - output stream
      locale - The locale for this message.
      params - An array of parameters for the message.
      Throws:
      IOException - if an error occurs
    • getID

      public String getID()
      Gets the message ID.
      Returns:
      the ID
    • getResource

      public String getResource()
    • toString

      public String toString()
      Formats this object as a String. Returns the same value as getID().
      Overrides:
      toString in class Object
      Returns:
      This object formatted as a String.