Cumulus4j API
(1.0.0)

org.cumulus4j.keymanager.front.shared
Class Error

java.lang.Object
  extended by org.cumulus4j.keymanager.front.shared.Error
All Implemented Interfaces:
Serializable

public class Error
extends Object
implements Serializable

DTO for sending an error back to the client (KeyManagerAPI). It can optionally wrap a Throwable to provide more precise information (the type) than just a message.

Author:
Marco หงุ่ยตระกูล-Schulze - marco at nightlabs dot de
See Also:
Serialized Form

Constructor Summary
Error()
          Create an empty instance of Error.
Error(String message)
          Create an instance of Error with an error message.
Error(Throwable throwable)
          Create an instance of Error wrapping a Throwable.
 
Method Summary
 String getMessage()
          Get the error-message.
 String getRootMessage()
          Get the root-Throwable's exception-message.
 String getRootType()
          Get the fully qualified class-name of the root-Throwable in the exception's cause-chain.
 String getType()
          Get the fully qualified class-name of the wrapped Throwable.
 void setMessage(String message)
          Set the error-message.
 void setRootMessage(String rootMessage)
          Set the root-Throwable's exception-message.
 void setRootType(String rootType)
          Get the fully qualified class-name of the root-Throwable in the exception's cause-chain.
 void setType(String type)
          Set the fully qualified class-name of the wrapped Throwable.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

Error

public Error()
Create an empty instance of Error. Only used for serialisation/deserialisation.


Error

public Error(Throwable throwable)
Create an instance of Error wrapping a Throwable.

Parameters:
throwable - the error to be wrapped and sent back to the client instead of a normal response.

Error

public Error(String message)
Create an instance of Error with an error message.

Parameters:
message - the message describing what went wrong.
Method Detail

getRootType

public String getRootType()
Get the fully qualified class-name of the root-Throwable in the exception's cause-chain.

Returns:
the fully qualified class-name of the root-Throwable. Can be null.

setRootType

public void setRootType(String rootType)
Get the fully qualified class-name of the root-Throwable in the exception's cause-chain.

Parameters:
rootType - the fully qualified class-name of the root-Throwable or null.

getRootMessage

public String getRootMessage()
Get the root-Throwable's exception-message.

Returns:
the message of the root-Throwable in the exception's cause-chain.

setRootMessage

public void setRootMessage(String rootMessage)
Set the root-Throwable's exception-message.

Parameters:
rootMessage - the message of the root-Throwable in the exception's cause-chain.

getType

public String getType()
Get the fully qualified class-name of the wrapped Throwable.

Returns:
the fully qualified class-name of the wrapped Throwable.

setType

public void setType(String type)
Set the fully qualified class-name of the wrapped Throwable.

Parameters:
type - the fully qualified class-name of the wrapped Throwable.

getMessage

public String getMessage()
Get the error-message. If this Error wraps a Throwable, this is Throwable.getMessage()

Returns:
the error-message.

setMessage

public void setMessage(String message)
Set the error-message.

Parameters:
message - the error-message.

Cumulus4j API
(1.0.0)

Copyright © 2012 NightLabs Consulting GmbH. All Rights Reserved.