Search in sources :

Example 1 with ColumnId

use of io.debezium.relational.ColumnId in project debezium by debezium.

the class ColumnMappers method mapperFor.

/**
 * Get the value mapping function for the given column.
 *
 * @param tableId the identifier of the table to which the column belongs; may not be null
 * @param column the column; may not be null
 * @return the mapping function, or null if there is no mapping function
 */
public ColumnMapper mapperFor(TableId tableId, Column column) {
    ColumnId id = new ColumnId(tableId, column.name());
    Optional<MapperRule> matchingRule = rules.stream().filter(rule -> rule.matches(id)).findFirst();
    if (matchingRule.isPresent()) {
        return matchingRule.get().mapper;
    }
    return null;
}
Also used : ColumnId(io.debezium.relational.ColumnId) Predicates(io.debezium.function.Predicates) Predicate(java.util.function.Predicate) Configuration(io.debezium.config.Configuration) TableId(io.debezium.relational.TableId) ArrayList(java.util.ArrayList) List(java.util.List) Immutable(io.debezium.annotation.Immutable) Selectors(io.debezium.relational.Selectors) Column(io.debezium.relational.Column) ConnectException(org.apache.kafka.connect.errors.ConnectException) ValueConverter(io.debezium.relational.ValueConverter) ColumnId(io.debezium.relational.ColumnId) Optional(java.util.Optional) Table(io.debezium.relational.Table) Strings(io.debezium.util.Strings)

Aggregations

Immutable (io.debezium.annotation.Immutable)1 Configuration (io.debezium.config.Configuration)1 Predicates (io.debezium.function.Predicates)1 Column (io.debezium.relational.Column)1 ColumnId (io.debezium.relational.ColumnId)1 Selectors (io.debezium.relational.Selectors)1 Table (io.debezium.relational.Table)1 TableId (io.debezium.relational.TableId)1 ValueConverter (io.debezium.relational.ValueConverter)1 Strings (io.debezium.util.Strings)1 ArrayList (java.util.ArrayList)1 List (java.util.List)1 Optional (java.util.Optional)1 Predicate (java.util.function.Predicate)1 ConnectException (org.apache.kafka.connect.errors.ConnectException)1