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

org.mariadb.jdbc.codec.NonNullParameter Maven / Gradle / Ivy

The newest version!
// SPDX-License-Identifier: LGPL-2.1-or-later
// Copyright (c) 2012-2014 Monty Program Ab
// Copyright (c) 2015-2024 MariaDB Corporation Ab
package org.mariadb.jdbc.codec;

import java.io.IOException;
import java.sql.SQLException;
import org.mariadb.jdbc.client.Context;
import org.mariadb.jdbc.client.socket.Writer;
import org.mariadb.jdbc.plugin.Codec;

/**
 * Parameter wrapper for primitive, knowing that value cannot be null, permitting fast path for few
 * methods.
 *
 * @param  value type
 */
public class NonNullParameter extends Parameter {

  public NonNullParameter(Codec codec, T value) {
    super(codec, value);
  }

  @Override
  public void encodeText(Writer encoder, Context context) throws IOException, SQLException {
    codec.encodeText(encoder, context, this.value, null, length);
  }

  @Override
  public boolean isNull() {
    return false;
  }
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy