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

br.com.objectos.sql.InsertValues3 Maven / Gradle / Ivy

package br.com.objectos.sql;

import br.com.objectos.db.Dialect;
import br.com.objectos.db.GeneratedKeyListener;
import br.com.objectos.db.InsertBuilder;
import br.com.objectos.db.InsertableValue;
import br.com.objectos.db.ParameterBinder;
import java.util.List;
import javax.annotation.Generated;

@Generated("br.com.objectos.sql.BootProcessor")
public class InsertValues3 extends InsertNode implements InsertValues, InsertableRow3, InsertableRow3.Values {
  final InsertValue val1;

  final InsertValue val2;

  final InsertValue val3;

  InsertValues3(InsertNode previous, T1 val1, T2 val2, T3 val3) {
    super(previous);
    this.val1 = InsertValue.of(val1);
    this.val2 = InsertValue.of(val2);
    this.val3 = InsertValue.of(val3);
  }

  private InsertValues3(InsertNode previous, InsertValue val1, InsertValue val2, InsertValue val3) {
    super(previous);
    this.val1 = val1;
    this.val2 = val2;
    this.val3 = val3;
  }

  @Override
  public InsertQuery compile(Dialect dialect) {
    return new SimpleInsertQuery(dialect, this);
  }

  @Override
  public InsertValues3 onGeneratedKey(GeneratedKeyListener listener) {
    return new OnGeneratedKey<>(this, val1, val2, val3, listener);
  }

  @Override
  public InsertValues3 values(T1 val1, T2 val2, T3 val3) {
    return new More<>(this, val1, val2, val3);
  }

  @Override
  ParameterBinder bind0(ParameterBinder binder) {
    val1.bind(binder);
    val2.bind(binder);
    val3.bind(binder);
    return binder;
  }

  @Override
  InsertBuilder write0(InsertBuilder sql) {
    return sql.values(val1, val2, val3);
  }

  private static class OnGeneratedKey extends InsertValues3 {
    private final GeneratedKeyListener listener;

    public OnGeneratedKey(InsertNode previous, InsertValue val1, InsertValue val2, InsertValue val3, GeneratedKeyListener listener) {
      super(previous, val1, val2, val3);
      this.listener = listener;
    }

    @Override
    void acceptListenerList(List listenerList) {
      super.acceptListenerList(listenerList);
      listenerList.add(listener);
    }

    @Override
    ParameterBinder bind0(ParameterBinder binder) {
      return binder;
    }

    @Override
    InsertBuilder write0(InsertBuilder sql) {
      return sql;
    }
  }

  private static class More extends InsertValues3 {
    public More(InsertNode previous, T1 val1, T2 val2, T3 val3) {
      super(previous, val1, val2, val3);
    }

    @Override
    InsertBuilder write0(InsertBuilder sql) {
      return sql.moreValues(val1, val2, val3);
    }
  }
}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy