All Downloads are FREE. Search and download functionalities are using the official Maven repository.

com.clougence.cloudcanal.sdk.api.modelv2.SchemaInfo Maven / Gradle / Ivy

There is a newer version: 1.3.1
Show newest version
package com.clougence.cloudcanal.sdk.api.modelv2;

import lombok.Getter;

/**
 * @author bucketli 2021/12/1 10:50:38
 */
@Getter
public class SchemaInfo {

    /**
     * for mysql/mongodb is null, for oracle is sid/dbName, for sqlserver/postgresql is dbName
     */
    private final String catalog;

    /**
     * for mysql/mongodb/hive is dbName, for oracle is schema/owner,for sqlserver/postgresql is schema
     */
    private final String schema;

    /**
     * for mysql/oracle/sqlserver/postgresql/kudu/hive is tableName,for mongodb is collection,for MQ is topic/queue ,for elasticsearch is index,for redis is key prefix
     */
    private final String table;

    /**
     * when mq is source
     */
    private final String topic;

    public SchemaInfo(String catalog, String schema, String table){
        this.catalog = catalog;
        this.schema = schema;
        this.table = table;
        this.topic = null;
    }

    public SchemaInfo(String catalog, String schema, String table, String topic){
        this.catalog = catalog;
        this.schema = schema;
        this.table = table;
        this.topic = topic;
    }

    @Override
    public boolean equals(Object o) {
        if (this == o)
            return true;
        if (o == null || getClass() != o.getClass())
            return false;

        SchemaInfo that = (SchemaInfo) o;

        if (catalog != null ? !catalog.equals(that.catalog) : that.catalog != null)
            return false;
        if (schema != null ? !schema.equals(that.schema) : that.schema != null)
            return false;
        if (table != null ? !table.equals(that.table) : that.table != null)
            return false;
        return topic != null ? topic.equals(that.topic) : that.topic == null;
    }

    @Override
    public int hashCode() {
        int result = catalog != null ? catalog.hashCode() : 0;
        result = 31 * result + (schema != null ? schema.hashCode() : 0);
        result = 31 * result + (table != null ? table.hashCode() : 0);
        result = 31 * result + (topic != null ? topic.hashCode() : 0);
        return result;
    }
}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy