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

com.scalar.db.sql.common.metadata.IndexMetadataImpl Maven / Gradle / Ivy

There is a newer version: 3.14.0
Show newest version
package com.scalar.db.sql.common.metadata;

import com.google.common.base.MoreObjects;
import com.scalar.db.sql.metadata.IndexMetadata;
import java.util.Objects;
import javax.annotation.concurrent.Immutable;

@Immutable
public class IndexMetadataImpl implements IndexMetadata {

  private final String namespaceName;
  private final String tableName;
  private final String columnName;

  private IndexMetadataImpl(String namespaceName, String tableName, String columnName) {
    this.namespaceName = Objects.requireNonNull(namespaceName);
    this.tableName = Objects.requireNonNull(tableName);
    this.columnName = Objects.requireNonNull(columnName);
  }

  @Override
  public String getNamespaceName() {
    return namespaceName;
  }

  @Override
  public String getTableName() {
    return tableName;
  }

  @Override
  public String getColumnName() {
    return columnName;
  }

  @Override
  public String toString() {
    return MoreObjects.toStringHelper(this)
        .add("namespaceName", namespaceName)
        .add("tableName", tableName)
        .add("columnName", columnName)
        .toString();
  }

  @Override
  public boolean equals(Object o) {
    if (this == o) {
      return true;
    }
    if (!(o instanceof IndexMetadataImpl)) {
      return false;
    }
    IndexMetadataImpl that = (IndexMetadataImpl) o;
    return Objects.equals(namespaceName, that.namespaceName)
        && Objects.equals(tableName, that.tableName)
        && Objects.equals(columnName, that.columnName);
  }

  @Override
  public int hashCode() {
    return Objects.hash(namespaceName, tableName, columnName);
  }

  public static IndexMetadata create(String namespaceName, String tableName, String columnName) {
    return new IndexMetadataImpl(namespaceName, tableName, columnName);
  }
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy