com.cedarsoft.exceptions
Class ApplicationException

java.lang.Object
  extended by java.lang.Throwable
      extended by java.lang.Exception
          extended by java.lang.RuntimeException
              extended by com.cedarsoft.exceptions.ApplicationException
All Implemented Interfaces:
Serializable

public abstract class ApplicationException
extends RuntimeException

Author:
Johannes Schneider (js@cedarsoft.com)
See Also:
Serialized Form

Nested Class Summary
static interface ApplicationException.Details
           
 
Constructor Summary
protected ApplicationException(Throwable cause, T details, Object... messageArguments)
          Creates a new ApplicationException including a cause (which is never presented to the user).
protected ApplicationException(T details, Object... messageArguments)
          Creates a new ApplicationException
 
Method Summary
 ApplicationException.Details getDetails()
          Returns the details
 ErrorCode getErrorCode()
          Returns the error code
 String getLocalizedMessage()
          Returns the localized message for the default locale
 String getLocalizedMessage(Locale locale)
          Returns the localized message for the given locale
 String getMessage()
           
 Object[] getMessageArguments()
          Returns the message arguments.
 String getTitle()
          Returns the title for the default locale
 String getTitle(Locale locale)
          Returns the title for the given locale
 
Methods inherited from class java.lang.Throwable
fillInStackTrace, getCause, getStackTrace, initCause, printStackTrace, printStackTrace, printStackTrace, setStackTrace, toString
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

ApplicationException

protected ApplicationException(@Nonnull
                               T details,
                               @Nonnull
                               Object... messageArguments)
Creates a new ApplicationException

Type Parameters:
T - the details type
Parameters:
details - the details (an enum that implements ApplicationException.Details
messageArguments - the (optional) message arguments

ApplicationException

protected ApplicationException(@Nullable
                               Throwable cause,
                               @Nonnull
                               T details,
                               @Nonnull
                               Object... messageArguments)
Creates a new ApplicationException including a cause (which is never presented to the user).

Type Parameters:
T - the details type
Parameters:
cause - the cause
details - the details
messageArguments - the (optional) message arguments
Method Detail

getDetails

@Nonnull
public ApplicationException.Details getDetails()
Returns the details

Returns:
the details

getMessageArguments

@Nonnull
public Object[] getMessageArguments()
Returns the message arguments.

Returns:
the message arguments

getMessage

public String getMessage()
Overrides:
getMessage in class Throwable
Returns:
the message (based on the error code)

getErrorCode

@Nonnull
public ErrorCode getErrorCode()
Returns the error code

Returns:
the error code

getLocalizedMessage

@Nonnull
public String getLocalizedMessage()
Returns the localized message for the default locale

Overrides:
getLocalizedMessage in class Throwable
Returns:
the localized message for the default locale

getLocalizedMessage

@Nonnull
public String getLocalizedMessage(@Nonnull
                                          Locale locale)
Returns the localized message for the given locale

Parameters:
locale - the locale
Returns:
the localized message for the given locale

getTitle

@Nonnull
public String getTitle()
Returns the title for the default locale

Returns:
the title

getTitle

@Nonnull
public String getTitle(@Nonnull
                               Locale locale)
Returns the title for the given locale

Parameters:
locale - the locale
Returns:
the title for the locale


Copyright © 2012 cedarsoft GmbH. All Rights Reserved.