Class TreeException
java.lang.Object
java.lang.Throwable
java.lang.Exception
com.madzera.happytree.exception.TreeException
- All Implemented Interfaces:
Serializable
The class
TreeException represents a checked exception for the
HappyTree API by inheriting the Exception class.
The TreeException is the only checked exception class that
can be thrown by this API. This happens when the following validations are
not met:
- When there is another session with the same identifier while initializing a new session;
- When the class of the object to be transformed has not been annotated
with
@Tree,@Id, and@Parentwhen initializing a new session; - When the annotated attributes
@Idand@Parenthave different types; - When the transaction has no session selected to work on;
- When the current session is not active;
- When there are mismatched parameterized types when invoking operations;
- When there is an attempt to handle an element that does not belong to the current session;
- When there is an attempt to handle the root element of the tree;
- When the element to be cut/copied/removed is not in the ATTACHED state in its lifecycle;
- When the element to be updated is in the NOT_EXISTED state in its lifecycle;
- When the element to be persisted is not in the NOT_EXISTED state in its lifecycle;
- When there is an
Elementobject with a duplicate@Idwhile trying to insert/update or cut/copy an element between trees;
- Author:
- Diego Madson de Andrade Nóbrega
- See Also:
-
Constructor Summary
ConstructorsConstructorDescriptionDefault constructor for this exception.TreeException(String message) This constructor allows specifying a detail message for the exception when it is thrown.TreeException(String message, Throwable cause) Creates an exception with the specifiedmessageandcause.TreeException(Throwable cause) Creates an exception with the specifiedcause. -
Method Summary
Methods inherited from class Throwable
addSuppressed, fillInStackTrace, getCause, getLocalizedMessage, getMessage, getStackTrace, getSuppressed, initCause, printStackTrace, printStackTrace, printStackTrace, setStackTrace, toString
-
Constructor Details
-
TreeException
public TreeException()Default constructor for this exception. This invocation implies anulldetail message for the exception as well as anullcause.To initialize a cause, invoke
Throwable.initCause(Throwable). -
TreeException
This constructor allows specifying a detail message for the exception when it is thrown. In this case, the cause of the exception isnull.To initialize a cause, invoke
Throwable.initCause(Throwable).- Parameters:
message- the detail message of the exception
-
TreeException
Creates an exception with the specifiedcause. In this case, the message of the exception will be the message associated with thecauseparameter.- Parameters:
cause- the cause of the exception
-
TreeException
Creates an exception with the specifiedmessageandcause. In this case, the exception will have the detail message set by themessageparameter and thecauseparameter as theThrowable.initCause(Throwable).- Parameters:
message- the detail message of the exceptioncause- the cause of the exception
-