Package org.flywaydb.core.api.callback

## Class BaseCallback

- java.lang.Object
- - org.flywaydb.core.api.callback.BaseCallback

- All Implemented Interfaces:
    `Callback`

      public abstract class BaseCallback
      extends java.lang.Object
      implements Callback

  Base implementation of Callback from which one can inherit. This is a convenience class that assumes by default that all events are handled and all handlers can run within a transaction.

- - ### Constructor Summary

    Constructors
    Constructor | Description
    --- | ---
    `BaseCallback()` |

  - ### Method Summary

    All Methods Instance Methods Concrete Methods
    Modifier and Type | Method | Description
    --- | --- | ---
    `boolean` | `canHandleInTransaction​(Event event, Context context)` | Whether this event can be handled in a transaction or whether it must be handled outside a transaction instead.
    `java.lang.String` | `getCallbackName()` | The callback name, Flyway will use this to sort the callbacks alphabetically before executing them
    `boolean` | `supports​(Event event, Context context)` | Whether this callback supports this event or not.

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

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

    - ### Methods inherited from interface org.flywaydb.core.api.callback.Callback

      `handle`

- - ### Constructor Detail

    - #### BaseCallback

          public BaseCallback()

  - ### Method Detail

    - #### supports

          public boolean supports​(Event event,
                                  Context context)

      Description copied from interface: `Callback`
      Whether this callback supports this event or not. This is primarily meant as a way to optimize event handling by avoiding unnecessary connection state setups for events that will not be handled anyway.
      Specified by:
        `supports` in interface `Callback`
      Parameters:
        `event` - The event to check.
        `context` - The context for this event.
      Returns:
        `true` if it can be handled, `false` if not.

    - #### canHandleInTransaction

          public boolean canHandleInTransaction​(Event event,
                                                Context context)

      Description copied from interface: `Callback`
      Whether this event can be handled in a transaction or whether it must be handled outside a transaction instead. In the vast majority of the cases the answer will be `true`. Only in the rare cases where non-transactional statements are executed should this return `false`. This method is called before `Callback.handle(Event, Context)` in order to determine in advance whether a transaction can be used or not.
      Specified by:
        `canHandleInTransaction` in interface `Callback`
      Parameters:
        `event` - The event to check.
        `context` - The context for this event.
      Returns:
        `true` if it can be handled within a transaction (almost all cases). `false` if it must be handled outside a transaction instead (very rare).

    - #### getCallbackName

          public java.lang.String getCallbackName()

      Description copied from interface: `Callback`
      The callback name, Flyway will use this to sort the callbacks alphabetically before executing them
      Specified by:
        `getCallbackName` in interface `Callback`
      Returns:
        The callback name