001/* 002 * Copyright 2015-2022 Transmogrify LLC, 2022-2024 Revetware LLC. 003 * 004 * Licensed under the Apache License, Version 2.0 (the "License"); 005 * you may not use this file except in compliance with the License. 006 * You may obtain a copy of the License at 007 * 008 * http://www.apache.org/licenses/LICENSE-2.0 009 * 010 * Unless required by applicable law or agreed to in writing, software 011 * distributed under the License is distributed on an "AS IS" BASIS, 012 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 013 * See the License for the specific language governing permissions and 014 * limitations under the License. 015 */ 016 017package com.pyranid; 018 019import javax.annotation.Nonnull; 020import java.sql.PreparedStatement; 021import java.util.List; 022 023/** 024 * Contract for binding parameters to SQL prepared statements. 025 * 026 * @author <a href="https://www.revetkn.com">Mark Allen</a> 027 * @since 1.0.0 028 */ 029@FunctionalInterface 030public interface PreparedStatementBinder { 031 /** 032 * Binds parameters to a SQL prepared statement. 033 * 034 * @param preparedStatement the prepared statement to bind to 035 * @param statementContext current SQL context 036 * @param parameters the parameters to bind to the {@link PreparedStatement}, if any 037 * @throws DatabaseException if an error occurs during binding 038 */ 039 <T> void bind(@Nonnull StatementContext<T> statementContext, 040 @Nonnull PreparedStatement preparedStatement, 041 @Nonnull List<Object> parameters); 042}