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

br.com.objectos.way.sql.SimpleSelectWhere5Int Maven / Gradle / Ivy

There is a newer version: 0.4.1
Show newest version
package br.com.objectos.way.sql;

import br.com.objectos.way.db.Condition;
import br.com.objectos.way.db.IntTypeColumn;
import br.com.objectos.way.db.Selectable;
import br.com.objectos.way.db.Variable;
import java.util.Objects;
import javax.annotation.Generated;

@Generated("br.com.objectos.way.sql.BootProcessor")
public final class SimpleSelectWhere5Int extends AbstractSimpleSelectWhere5 implements SimpleSelectWhereInt, V> {
  final Keyword keyword;

  private final V first;

  SimpleSelectWhere5Int(SelectNode> previous, Keyword keyword, V first) {
    super(previous);
    this.keyword = keyword;
    this.first = first;
  }

  @Override
  public SimpleSelectWhere5 eq(int value) {
    return comparison(NumericComparison.EQ, value);
  }

  @Override
  public SimpleSelectWhere5 eq(IntTypeColumn column) {
    return comparison(NumericComparison.EQ, column);
  }

  @Override
  public Object eq(Variable variable) {
    throw new UnsupportedOperationException();
  }

  @Override
  public Object gt() {
    throw new UnsupportedOperationException();
  }

  @Override
  public SimpleSelectWhere5 gt(int value) {
    return comparison(NumericComparison.GT, value);
  }

  @Override
  public SimpleSelectWhere5 gt(IntTypeColumn column) {
    return comparison(NumericComparison.GT, column);
  }

  @Override
  public Object gt(Variable variable) {
    throw new UnsupportedOperationException();
  }

  @Override
  Condition condition() {
    return NumericComparison.EQ.ofColumn(first);
  }

  private SimpleSelectWhere5 comparison(NumericComparison operator, int value) {
    Condition condition = operator.ofColumn(first.withValue(value));
    return new SimpleSelectWhere5<>(this, condition);
  }

  private SimpleSelectWhere5 comparison(NumericComparison operator, IntTypeColumn column) {
    Objects.requireNonNull(column);
    Condition condition = operator.ofColumn(first, column);
    return new SimpleSelectWhere5<>(this, condition);
  }
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy