Class DdlChanges

java.lang.Object
io.debezium.relational.ddl.DdlChanges
All Implemented Interfaces:
DdlParserListener

@NotThreadSafe public class DdlChanges extends Object implements DdlParserListener
A DdlParserListener that accumulates changes, allowing them to be consumed in the same order by database.
Author:
Randall Hauch
  • Field Details

  • Constructor Details

    • DdlChanges

      public DdlChanges()
      Create a new changes object with ';' as the terminator token.
    • DdlChanges

      public DdlChanges(String terminator)
      Create a new changes object with the designated terminator token.
      Parameters:
      terminator - the token used to terminate each statement; may be null
  • Method Details

    • reset

      public DdlChanges reset()
      Clear all accumulated changes.
      Returns:
      this object for method chaining; never null
    • handle

      public void handle(DdlParserListener.Event event)
      Description copied from interface: DdlParserListener
      Handle a DDL event.
      Specified by:
      handle in interface DdlParserListener
      Parameters:
      event - the DDL event; never null
    • groupStatementStringsByDatabase

      public void groupStatementStringsByDatabase(DdlChanges.DatabaseStatementStringConsumer consumer)
      Consume the events in the same order they were recorded, but grouped by database name. Multiple sequential statements that were applied to the same database are grouped together.
      Parameters:
      consumer - the consumer
    • addTable

      private void addTable(Set<TableId> tables, DdlParserListener.Event event)
    • groupStatementsByDatabase

      public void groupStatementsByDatabase(DdlChanges.DatabaseStatementConsumer consumer)
      Consume the events in the same order they were recorded, but grouped by database name. Multiple sequential statements that were applied to the same database are grouped together.
      Parameters:
      consumer - the consumer
    • groupEventsByDatabase

      public void groupEventsByDatabase(DdlChanges.DatabaseEventConsumer consumer)
      Consume the events in the same order they were recorded, but grouped by database name. Multiple sequential statements that were applied to the same database are grouped together.
      Parameters:
      consumer - the consumer
    • getEventsByDatabase

      public void getEventsByDatabase(DdlChanges.DatabaseEventConsumer consumer)
      Consume the events in the same order they were recorded, but grouped by database name. Multiple sequential statements that were applied to the same database are grouped together.
      Parameters:
      consumer - the consumer
    • getDatabase

      protected String getDatabase(DdlParserListener.Event event)
    • isEmpty

      public boolean isEmpty()
    • applyToMoreDatabasesThan

      public boolean applyToMoreDatabasesThan(String name)
    • toString

      public String toString()
      Overrides:
      toString in class Object
    • anyMatch

      @Deprecated public boolean anyMatch(Predicate<String> databaseFilter, Predicate<TableId> tableFilter)
      Deprecated.
      Returns:
      true if any event stored is one of
      • database-wide events and affects included/excluded database
      • table related events and the table is included
      • events that set a variable and either affects included database or is a system-wide variable
      • anyMatch

        public boolean anyMatch(RelationalTableFilters filters)
        Returns:
        true if any event stored is one of
        • database-wide events and affects included/excluded database
        • table related events and the table is included
        • events that set a variable and either affects included database or is a system-wide variable