Package org.firebirdsql.jaybird.props.internal

## Class TransactionNameMapping

- java.lang.Object
- - org.firebirdsql.jaybird.props.internal.TransactionNameMapping

-     @InternalApi
      public final class TransactionNameMapping
      extends java.lang.Object

  Mapping of transaction names to JDBC transaction code and vice versa.
  Since:
    5
  Author:
    Mark Rotteveel

- - ### Field Summary

    Fields
    Modifier and Type | Field | Description
    --- | --- | ---
    `static java.lang.String` | `TRANSACTION_NONE` |
    `static java.lang.String` | `TRANSACTION_READ_COMMITTED` |
    `static java.lang.String` | `TRANSACTION_READ_UNCOMMITTED` |
    `static java.lang.String` | `TRANSACTION_REPEATABLE_READ` |
    `static java.lang.String` | `TRANSACTION_SERIALIZABLE` |

  - ### Method Summary

    All Methods Static Methods Concrete Methods
    Modifier and Type | Method | Description
    --- | --- | ---
    `static int` | `toIsolationLevel​(java.lang.String isolationLevelName)` | Maps a transaction isolation level name to the JDBC transaction isolation level.
    `static java.lang.String` | `toIsolationLevelName​(int isolationLevel)` | Maps a JDBC transaction isolation level to a string name.
    `static java.lang.String` | `toIsolationLevelName​(int isolationLevel, boolean lenient)` | Maps a JDBC transaction isolation level to a string name.

    - ### Methods inherited from class java.lang.Object

      `clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

- - ### Field Detail

    - #### TRANSACTION_NONE

          public static final java.lang.String TRANSACTION_NONE

      See Also:
        Constant Field Values

    - #### TRANSACTION_READ_UNCOMMITTED

          public static final java.lang.String TRANSACTION_READ_UNCOMMITTED

      See Also:
        Constant Field Values

    - #### TRANSACTION_READ_COMMITTED

          public static final java.lang.String TRANSACTION_READ_COMMITTED

      See Also:
        Constant Field Values

    - #### TRANSACTION_REPEATABLE_READ

          public static final java.lang.String TRANSACTION_REPEATABLE_READ

      See Also:
        Constant Field Values

    - #### TRANSACTION_SERIALIZABLE

          public static final java.lang.String TRANSACTION_SERIALIZABLE

      See Also:
        Constant Field Values

  - ### Method Detail

    - #### toIsolationLevel

          public static int toIsolationLevel​(java.lang.String isolationLevelName)

      Maps a transaction isolation level name to the JDBC transaction isolation level.

      Accepted string names are `"TRANSACTION_NONE"`, `"TRANSACTION_READ_UNCOMMITTED"`, `"TRANSACTION_READ_COMMITTED"`, `"TRANSACTION_REPEATABLE_READ"`, `"TRANSACTION_SERIALIZABLE"`. To simplify mapping connection properties, the string value of the isolation level integer (e.g. `"2"` for `Connection.TRANSACTION_READ_COMMITTED`) is also accepted.

      Parameters:
        `isolationLevelName` - Transaction isolation level name or integer string (not `null`)
      Returns:
        JDBC standard isolation level value
      Throws:
        `java.lang.IllegalArgumentException` - For an unknown transaction isolation level name

    - #### toIsolationLevelName

          public static java.lang.String toIsolationLevelName​(int isolationLevel)

      Maps a JDBC transaction isolation level to a string name.
      Parameters:
        `isolationLevel` - JDBC isolation level
      Returns:
        name of the isolation level (e.g. `"TRANSACTION_READ_COMMITTED"`)
      Throws:
        `java.lang.IllegalArgumentException` - When `isolationLevel` is not a known JDBC transaction isolation level

    - #### toIsolationLevelName

          public static java.lang.String toIsolationLevelName​(int isolationLevel,
                                                              boolean lenient)

      Maps a JDBC transaction isolation level to a string name.
      Parameters:
        `isolationLevel` - JDBC isolation level
        `lenient` - `true` return integer string for unknown values, `false` throw `IllegalArgumentException` for unknown values
      Returns:
        name of the isolation level (e.g. TRANSACTION_READ_COMMITTED), or, when `lenient` is `true`, the integer string for unknown values
      Throws:
        `java.lang.IllegalArgumentException` - When `isolationLevel` is not a known JDBC transaction isolation level and `lenient` is `false`