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

com.scalar.db.sql.statement.JoinStatement Maven / Gradle / Ivy

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

import java.util.Objects;
import javax.annotation.concurrent.Immutable;

@Immutable
public class JoinStatement implements CommandStatement {

  public final String transactionId;

  private JoinStatement(String transactionId) {
    this.transactionId = Objects.requireNonNull(transactionId);
  }

  @Override
  public String toSql() {
    StringBuilder builder = new StringBuilder("JOIN ");
    StatementUtils.appendStringLiteral(builder, transactionId);
    return builder.toString();
  }

  @Override
  public  R accept(CommandStatementVisitor visitor, C context) {
    return visitor.visit(this, context);
  }

  @Override
  public  R accept(StatementVisitor visitor, C context) {
    return visitor.visit(this, context);
  }

  @Override
  public String toString() {
    return toSql();
  }

  @Override
  public boolean equals(Object o) {
    if (this == o) {
      return true;
    }
    if (!(o instanceof JoinStatement)) {
      return false;
    }
    JoinStatement that = (JoinStatement) o;
    return Objects.equals(transactionId, that.transactionId);
  }

  @Override
  public int hashCode() {
    return Objects.hash(transactionId);
  }

  public static JoinStatement create(String transactionId) {
    return new JoinStatement(transactionId);
  }
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy