Package org.firebirdsql.util
Class SQLExceptionChainBuilder<E extends java.sql.SQLException>
- java.lang.Object
- 
- org.firebirdsql.util.SQLExceptionChainBuilder<E>
 
- 
- Type Parameters:
- E- type of SQLException (definition:- E extends SQLException)
 
 @InternalApi public final class SQLExceptionChainBuilder<E extends java.sql.SQLException> extends java.lang.Object Helper class for buildingSQLExceptionchains.NOTE: This class is not thread-safe; an instance should only be used on a single thread or with proper external synchronisation. - Since:
- 2.2
- Author:
- Mark Rotteveel
 
- 
- 
Constructor SummaryConstructors Constructor Description SQLExceptionChainBuilder()Create SQLExceptionChainBuilderSQLExceptionChainBuilder(E root)Create SQLExceptionChainBuilder with the specified root exception.
 - 
Method SummaryAll Methods Instance Methods Concrete Methods Modifier and Type Method Description SQLExceptionChainBuilder<E>addFirst(E sqle)Adds the passed SQLException as the first exception in the chain.SQLExceptionChainBuilder<E>append(E sqle)Appends the passed SQLException to the exception chain.EgetException()booleanhasException()java.util.Optional<java.sql.SQLException>optException()voidthrowIfPresent()Throws the root SQLException stored in the chain, if present; otherwise does nothing.
 
- 
- 
- 
Constructor Detail- 
SQLExceptionChainBuilderpublic SQLExceptionChainBuilder() Create SQLExceptionChainBuilder
 - 
SQLExceptionChainBuilderpublic SQLExceptionChainBuilder(E root) Create SQLExceptionChainBuilder with the specified root exception.- Parameters:
- root- root SQLException
 
 
- 
 - 
Method Detail- 
appendpublic SQLExceptionChainBuilder<E> append(E sqle) Appends the passed SQLException to the exception chain.If this SQLExceptionChainBuilder does not have a root, sqlewill be come the root.- Parameters:
- sqle- SQLException to add to the chain.
- Returns:
- this SQLExceptionChainBuilder
 
 - 
addFirstpublic SQLExceptionChainBuilder<E> addFirst(E sqle) Adds the passed SQLException as the first exception in the chain.If this SQLExceptionChainBuilder already has a root, that root will be chained to sqle, andsqlebecomes the new root.- Parameters:
- sqle- SQLException to add to the chain
- Returns:
- this SQLExceptionChainBuilder
- Since:
- 5
 
 - 
hasExceptionpublic boolean hasException() - Returns:
- trueif this SQLExceptionChainBuilder contains at least one SQLException.
 
 - 
getExceptionpublic E getException() - Returns:
- the root SQLException or nullif no SQLException was added to this SQLExceptionChainBuilder
 
 - 
optExceptionpublic java.util.Optional<java.sql.SQLException> optException() - Returns:
- the root SQLException or empty if no SQLException was added to this SQLExceptionChainBuilder
- Since:
- 5.0.7
 
 - 
throwIfPresentpublic void throwIfPresent() throws java.sql.SQLExceptionThrows the root SQLException stored in the chain, if present; otherwise does nothing.- Throws:
- java.sql.SQLException- the root SQLException in this chain builder
- Since:
- 5.0.7
 
 
- 
 
-