com.ibm.commerce.foundation.common.exception

Class ApplicationError

  • java.lang.Object
    • com.ibm.commerce.foundation.common.exception.ApplicationError
  • All Implemented Interfaces:
    java.io.Serializable
    Direct Known Subclasses:
    ClientError


    public class ApplicationError
    extends java.lang.Object
    implements java.io.Serializable
    The client error object represents a particular error. When the caller specifies a series of invalid parameters, each invalid parameter is represented as a client error.
    See Also:
    Serialized Form
    • Constructor Summary

      Constructors 
      Constructor and Description
      ApplicationError()
      Creates an instance of the client error object.
      ApplicationError(short type, java.lang.String errorKey, java.lang.Object[] errorParameters, java.lang.String resourceBundleName)
      Creates an instance of the client error object.
      ApplicationError(short type, java.lang.String errorKey, java.lang.String localizedMessage, java.lang.Object[] errorParameters, java.lang.String resourceBundleName, java.lang.String errorCode)
      Creates an instance of the client error object.
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method and Description
      java.lang.String getErrorCode()
      This method returns the error code
      java.lang.String getErrorKey()
      This method returns the error key associated with the client error.
      java.lang.Object[] getErrorParameters()
      This method returns the error parameter to be used to help quantify the client error.
      java.util.Locale getLocale()
      This method returns the locale used by the getLocalizedMessage method.
      java.lang.String getLocalizedMessage()
      This method returns the localized message of the client error.
      java.lang.String getLocalizedMessage(java.util.Locale locale)
      This method returns the localized message of the client error.
      short getType()
      This method returns the type of the parameter error.
      void setErrorCode(java.lang.String astrErrorCode)
      This method sets error code.
      void setErrorKey(java.lang.String errorKey)
      This method sets the error key of the client error.
      void setErrorParameters(java.lang.Object[] errorParameters)
      This method sets the parameter errors.
      void setLocale(java.util.Locale locale)
      This method sets the locale used by the getLocalizedMessage method.
      void setLocalizedMessage(java.lang.String aLocalizedMessage)
      This method set the localized message of the client error.
      void setType(short type)
      This method sets the type of the client error.
      java.lang.String toString()
      This method returns a short description of this error.
      • Methods inherited from class java.lang.Object

        equals, getClass, hashCode, notify, notifyAll, wait, wait, wait
    • Field Detail

      • TYPE_GENERIC_ERROR

        public static final short TYPE_GENERIC_ERROR
        The client error type to indicate a generic error.
        See Also:
        Constant Field Values
      • TYPE_MISSING_PARAMETER

        public static final short TYPE_MISSING_PARAMETER
        The client error type to indicate a missing parameter.
        See Also:
        Constant Field Values
      • TYPE_INVALID_PARAMETER_VALUE

        public static final short TYPE_INVALID_PARAMETER_VALUE
        The client error type to indicate an invalid parameter value.
        See Also:
        Constant Field Values
      • TYPE_PARAMETER_VALUE_NOT_NUMERIC

        public static final short TYPE_PARAMETER_VALUE_NOT_NUMERIC
        The client error type to indicate the parameter is not a numeric.
        See Also:
        Constant Field Values
      • TYPE_MALFORMED_REQUEST

        public static final short TYPE_MALFORMED_REQUEST
        The client error type to indicate the request was improperly formed.
        See Also:
        Constant Field Values
    • Constructor Detail

      • ApplicationError

        public ApplicationError()
        Creates an instance of the client error object.
      • ApplicationError

        public ApplicationError(short type,
                                java.lang.String errorKey,
                                java.lang.Object[] errorParameters,
                                java.lang.String resourceBundleName)
        Creates an instance of the client error object.
        Parameters:
        type - The type of error that is being reported. Refer to the constants defined in this class.
        errorKey - The error key associated with the error.
        errorParameters - The error parameters to associated with the key.
        resourceBundleName - The name of the resource bundle to find the key.
      • ApplicationError

        public ApplicationError(short type,
                                java.lang.String errorKey,
                                java.lang.String localizedMessage,
                                java.lang.Object[] errorParameters,
                                java.lang.String resourceBundleName,
                                java.lang.String errorCode)
        Creates an instance of the client error object.
        Parameters:
        type - The type of error that is being reported. Refer to the constants defined in this class.
        errorKey - The error key associated with the error.
        localizedMessage - The localized error message associated with the error.
        errorParameters - The error parameters to associated with the key.
        resourceBundleName - The name of the resource bundle to find the key.
        errorCode - The error code to associated with the key.
    • Method Detail

      • getType

        public short getType()
        This method returns the type of the parameter error. This type can be used to classify the type of the client error.
        Returns:
        The type of the client error.
      • setType

        public void setType(short type)
        This method sets the type of the client error.
        Parameters:
        type - The type of the client error.
      • getErrorKey

        public java.lang.String getErrorKey()
        This method returns the error key associated with the client error. The purpose of this key is to represent the exact error so the presentation logic can display the appropriate error message.
        Returns:
        The error key of the client error.
      • setErrorKey

        public void setErrorKey(java.lang.String errorKey)
        This method sets the error key of the client error. The purpose of this key is to represent the exact error so the presentation logic can display the appropriate error message.
        Parameters:
        errorKey - The error key.
      • getErrorParameters

        public java.lang.Object[] getErrorParameters()
        This method returns the error parameter to be used to help quantify the client error. The purpose of the error parameters is to help the presentation logic to build up a meaningful message.
        Returns:
        The error parameters.
      • setErrorParameters

        public void setErrorParameters(java.lang.Object[] errorParameters)
        This method sets the parameter errors. The purpose of the error parameters is to help the presentation logic to build up a meaningful message.
        Parameters:
        errorParameters - The error parameters.
      • getLocale

        public java.util.Locale getLocale()
        This method returns the locale used by the getLocalizedMessage method.
        Returns:
        The locale.
      • setLocale

        public void setLocale(java.util.Locale locale)
        This method sets the locale used by the getLocalizedMessage method.
        Parameters:
        locale - The locale.
      • setLocalizedMessage

        public void setLocalizedMessage(java.lang.String aLocalizedMessage)
        This method set the localized message of the client error.
        Parameters:
        aLocalizedMessage - The localized error message
      • getLocalizedMessage

        public java.lang.String getLocalizedMessage()
        This method returns the localized message of the client error.
        Returns:
        The localized error message which preset in the client error
      • getLocalizedMessage

        public java.lang.String getLocalizedMessage(java.util.Locale locale)
        This method returns the localized message of the client error. The message returned will be based on the locale specified.
        Parameters:
        locale - The locale of the message to return.
        Returns:
        The localized error message.
      • getErrorCode

        public java.lang.String getErrorCode()
        This method returns the error code
        Returns:
        The Error Code of the exception.
      • setErrorCode

        public void setErrorCode(java.lang.String astrErrorCode)
        This method sets error code.
        Parameters:
        astrErrorCode - The Error Code of the exception.
      • toString

        public java.lang.String toString()
        This method returns a short description of this error. If this ApplicationError object was created with a non-null detailed message string, then the result is the concatenation of three strings:
        • The name of the actual class of this object
        • ": " (a colon and a space)
        • The result of the getLocalizedMessage() method for this object
        If this ApplicationError object was created with a null detailed message string, then the name of the actual class of this object is returned.
        Overrides:
        toString in class java.lang.Object
        Returns:
        This method returns a string representation of this error.