info.rolandkrueger.roklib.util
Class ApplicationError

java.lang.Object
  extended by info.rolandkrueger.roklib.util.ApplicationError

public class ApplicationError
extends Object

This class summarizes all information that is necessary to appropriately respond to an error situation. Objects of this class are passed to classes implementing the ApplicationMessageHandler interface.

Author:
Roland Krueger
See Also:
ApplicationMessageHandler

Nested Class Summary
static class ApplicationError.ErrorType
          Defines the seriousness of an error.
 
Field Summary
private  Throwable mCause
           
private  String mDescription
           
private  ApplicationError.ErrorType mType
           
 
Constructor Summary
protected ApplicationError()
          Default constructor that initializes the error level with ApplicationError.ErrorType.UNCRITICAL.
protected ApplicationError(ApplicationError.ErrorType type)
          Constructor for setting the error level.
  ApplicationError(String description)
          Constructor for setting the description of an error.
  ApplicationError(String description, ApplicationError.ErrorType type)
          Constructor for setting both the description of an error and its type.
  ApplicationError(String description, Throwable cause)
          Constructor for setting both the description of an error and its cause.
  ApplicationError(String description, Throwable cause, ApplicationError.ErrorType type)
          Constructor for setting the description, the cause and the type of the error.
 
Method Summary
 Throwable getCause()
          Returns the exception that caused this error.
 String getDescription()
          Returns the error message.
 ApplicationError.ErrorType getType()
          Returns the error level.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

mDescription

private String mDescription

mCause

private Throwable mCause

mType

private ApplicationError.ErrorType mType
Constructor Detail

ApplicationError

protected ApplicationError()
Default constructor that initializes the error level with ApplicationError.ErrorType.UNCRITICAL.


ApplicationError

protected ApplicationError(ApplicationError.ErrorType type)
Constructor for setting the error level.

Parameters:
type - seriousness of the error

ApplicationError

public ApplicationError(String description)
Constructor for setting the description of an error. The error's level defaults to ApplicationError.ErrorType.UNCRITICAL.

Parameters:
description - an error description. This can later be used as the error message.

ApplicationError

public ApplicationError(String description,
                        Throwable cause)
Constructor for setting both the description of an error and its cause. If the error happened due to an exception, this exception can be passed along with the ApplicationError object. The error's level defaults to ApplicationError.ErrorType.UNCRITICAL.

Parameters:
description - an error description. This can later be used as the error message.
cause - exception that caused this error to be created

ApplicationError

public ApplicationError(String description,
                        ApplicationError.ErrorType type)
Constructor for setting both the description of an error and its type.

Parameters:
description - an error description. This can later be used as the error message.
type - seriousness of the error

ApplicationError

public ApplicationError(String description,
                        Throwable cause,
                        ApplicationError.ErrorType type)
Constructor for setting the description, the cause and the type of the error.

Parameters:
description - an error description. This can later be used as the error message.
cause - exception that caused this error to be created
type - seriousness of the error
See Also:
ApplicationError(String, Throwable)
Method Detail

getDescription

public String getDescription()
Returns the error message.

Returns:
the error message

getCause

public Throwable getCause()
Returns the exception that caused this error.

Returns:
the cause of this error or null if no such information was provided
See Also:
ApplicationError(String, Throwable)

getType

public ApplicationError.ErrorType getType()
Returns the error level.

Returns:
the error level


Copyright © 2007-2011. All Rights Reserved.