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

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

/*
 * Copyright 2014 Objectos, Fábrica de Software LTDA.
 *
 * Licensed under the Apache License, Version 2.0 (the "License"); you may not
 * use this file except in compliance with the License. You may obtain a copy of
 * the License at
 *
 * http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
 * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
 * License for the specific language governing permissions and limitations under
 * the License.
 */
package br.com.objectos.way.sql;

import br.com.objectos.way.sql.SqlBuilder.SqlBuilderWhen;

/**
 * @author [email protected] (Marcio Endo)
 */
class SqlBuilderWhenAbsent implements SqlBuilderWhen {

  private final SqlBuilder delegate;

  public SqlBuilderWhenAbsent(SqlBuilder delegate) {
    this.delegate = delegate;
  }

  @Override
  public SqlBuilder append(char character) {
    return this;
  }

  @Override
  public SqlBuilder append(CanDecorateSqlBuilder element) {
    return this;
  }

  @Override
  public SqlBuilder append(String sql) {
    return this;
  }

  @Override
  public SqlBuilder endWhen() {
    return delegate;
  }

  @Override
  public SqlBuilder escape(String name) {
    return this;
  }

  @Override
  public SqlBuilderJoiner on(char separator) {
    return on(String.valueOf(separator));
  }

  @Override
  public SqlBuilderJoiner on(String separator) {
    return new SqlBuilderJoiner() {
      @Override
      public SqlBuilder join(String[] strings) {
        return SqlBuilderWhenAbsent.this;
      }

      @Override
      public SqlBuilder join(Iterable elements) {
        return SqlBuilderWhenAbsent.this;
      }
    };
  }

  @Override
  public SqlBuilder qualifiedName(String first, String second) {
    return this;
  }

  @Override
  public SqlBuilder space() {
    return this;
  }

  @Override
  public SqlBuilderWhen when(boolean present) {
    return new SqlBuilderWhenAbsent(this);
  }

}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy