Class SQLExceptionChainBuilder<E extends java.sql.SQLException>

  • Type Parameters:
    E - Type of SQLException (definition: E extends SQLException)

    public final class SQLExceptionChainBuilder<E extends java.sql.SQLException>
    extends java.lang.Object
    Helper class for building SQLException chains.

    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 Detail

      • SQLExceptionChainBuilder

        public SQLExceptionChainBuilder()
        Create SQLExceptionChainBuilder
      • SQLExceptionChainBuilder

        public SQLExceptionChainBuilder​(E root)
        Create SQLExceptionChainBuilder with the specified root exception.
        Parameters:
        root - Root SQLException
    • Method Detail

      • append

        public SQLExceptionChainBuilder<E> append​(E sqle)
        Appends the passed SQLException to the exception chain.

        If this SQLExceptionChainBuilder does not have a root, sqle will be come the root.

        Parameters:
        sqle - SQLException to add to the chain.
        Returns:
        this SQLExceptionChainBuilder
      • hasException

        public boolean hasException()
        Returns:
        true if this SQLExceptionChainBuilder contains at least one SQLException.
      • getException

        public E getException()
        Returns:
        The root SQLException or null if no SQLException was added to this SQLExceptionChainBuilder