org.hibernate.exception
Interface Nestable
- All Known Implementing Classes:
- AssertionFailure, BatchedTooManyRowsAffectedException, BatchFailedException, CacheException, CallbackException, ConstraintViolationException, DataException, DuplicateMappingException, GenericJDBCException, HibernateException, IdentifierGenerationException, InstantiationException, InvalidMappingException, InvalidWithClauseException, JDBCConnectionException, JDBCException, LazyInitializationException, LockAcquisitionException, MappingException, MappingNotFoundException, NestableException, NestableRuntimeException, NoCachingEnabledException, NonUniqueObjectException, NonUniqueResultException, ObjectDeletedException, ObjectNotFoundException, PersistentObjectException, PropertyAccessException, PropertyNotFoundException, PropertyValueException, QueryException, QueryExecutionRequestException, QueryParameterException, QuerySyntaxException, SerializationException, SessionException, SQLGrammarException, StaleObjectStateException, StaleStateException, TooManyRowsAffectedException, TransactionException, TransientObjectException, TypeMismatchException, UnresolvableObjectException, ValidationFailure, WrongClassException
public interface Nestable
An interface to be implemented by Throwable
extensions which would like to be able to nest root exceptions
inside themselves.
- Since:
- 1.0
| Method Summary | |
|---|---|
java.lang.Throwable |
getCause()
Returns the reference to the exception or error that caused the exception implementing the Nestable to be thrown. |
java.lang.String |
getMessage()
Returns the error message of this and any nested Throwable. |
java.lang.String |
getMessage(int index)
Returns the error message of the Throwable in the chain
of Throwables at the specified index, numbererd from 0. |
java.lang.String[] |
getMessages()
Returns the error message of this and any nested Throwables
in an array of Strings, one element for each message. |
java.lang.Throwable |
getThrowable(int index)
Returns the Throwable in the chain of
Throwables at the specified index, numbererd from 0. |
int |
getThrowableCount()
Returns the number of nested Throwables represented by
this Nestable, including this Nestable. |
java.lang.Throwable[] |
getThrowables()
Returns this Nestable and any nested Throwables
in an array of Throwables, one element for each
Throwable. |
int |
indexOfThrowable(java.lang.Class type)
Returns the index, numbered from 0, of the first occurrence of the specified type in the chain of Throwables, or -1 if the
specified type is not found in the chain. |
int |
indexOfThrowable(java.lang.Class type,
int fromIndex)
Returns the index, numbered from 0, of the first Throwable
that matches the specified type in the chain of Throwables
with an index greater than or equal to the specified index, or -1 if
the type is not found. |
void |
printPartialStackTrace(java.io.PrintWriter out)
Prints the stack trace for this exception only--root cause not included--using the provided writer. |
void |
printStackTrace(java.io.PrintStream out)
Prints the stack trace of this exception to the specified print stream. |
void |
printStackTrace(java.io.PrintWriter out)
Prints the stack trace of this exception to the specified print writer. |
| Method Detail |
|---|
getCause
java.lang.Throwable getCause()
- Returns the reference to the exception or error that caused the
exception implementing the
Nestableto be thrown.- Returns:
- throwable that caused the original exception
getMessage
java.lang.String getMessage()
- Returns the error message of this and any nested
Throwable.- Returns:
- the error message
getMessage
java.lang.String getMessage(int index)
- Returns the error message of the
Throwablein the chain ofThrowables at the specified index, numbererd from 0.- Parameters:
index- the index of theThrowablein the chain ofThrowables- Returns:
- the error message, or null if the
Throwableat the specified index in the chain does not contain a message - Throws:
java.lang.IndexOutOfBoundsException- if theindexargument is negative or not less than the count ofThrowables in the chain
getMessages
java.lang.String[] getMessages()
- Returns the error message of this and any nested
Throwables in an array of Strings, one element for each message. AnyThrowablenot containing a message is represented in the array by a null. This has the effect of cause the length of the returned array to be equal to the result of thegetThrowableCount()operation.- Returns:
- the error messages
getThrowable
java.lang.Throwable getThrowable(int index)
- Returns the
Throwablein the chain ofThrowables at the specified index, numbererd from 0.- Parameters:
index- the index, numbered from 0, of theThrowablein the chain ofThrowables- Returns:
- the
Throwable - Throws:
java.lang.IndexOutOfBoundsException- if theindexargument is negative or not less than the count ofThrowables in the chain
getThrowableCount
int getThrowableCount()
- Returns the number of nested
Throwables represented by thisNestable, including thisNestable.- Returns:
- the throwable count
getThrowables
java.lang.Throwable[] getThrowables()
- Returns this
Nestableand any nestedThrowables in an array ofThrowables, one element for eachThrowable.- Returns:
- the
Throwables
indexOfThrowable
int indexOfThrowable(java.lang.Class type)
- Returns the index, numbered from 0, of the first occurrence of the
specified type in the chain of
Throwables, or -1 if the specified type is not found in the chain.- Parameters:
type-Classto be found- Returns:
- index of the first occurrence of the type in the chain, or -1 if the type is not found
indexOfThrowable
int indexOfThrowable(java.lang.Class type,
int fromIndex)
- Returns the index, numbered from 0, of the first
Throwablethat matches the specified type in the chain ofThrowables with an index greater than or equal to the specified index, or -1 if the type is not found.- Parameters:
type-Classto be foundfromIndex- the index, numbered from 0, of the starting position in the chain to be searched- Returns:
- index of the first occurrence of the type in the chain, or -1 if the type is not found
- Throws:
java.lang.IndexOutOfBoundsException- if thefromIndexargument is negative or not less than the count ofThrowables in the chain
printStackTrace
void printStackTrace(java.io.PrintWriter out)
- Prints the stack trace of this exception to the specified print
writer. Includes information from the exception, if any,
which caused this exception.
- Parameters:
out-PrintWriterto use for output.
printStackTrace
void printStackTrace(java.io.PrintStream out)
- Prints the stack trace of this exception to the specified print
stream. Includes inforamation from the exception, if any,
which caused this exception.
- Parameters:
out-PrintStreamto use for output.
printPartialStackTrace
void printPartialStackTrace(java.io.PrintWriter out)
- Prints the stack trace for this exception only--root cause not
included--using the provided writer. Used by
org.apache.commons.lang.exception.NestableDelegateto write individual stack traces to a buffer. The implementation of this method should callsuper.printStackTrace(out);in most cases.- Parameters:
out- The writer to use.