001/* 002 * Copyright 2002-2020 the original author or authors. 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 * https://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 org.springframework.jdbc.core; 018 019import org.springframework.lang.Nullable; 020 021/** 022 * Interface to be implemented by objects that can provide SQL strings. 023 * 024 * <p>Typically implemented by PreparedStatementCreators, CallableStatementCreators 025 * and StatementCallbacks that want to expose the SQL they use to create their 026 * statements, to allow for better contextual information in case of exceptions. 027 * 028 * @author Juergen Hoeller 029 * @since 16.03.2004 030 * @see PreparedStatementCreator 031 * @see CallableStatementCreator 032 * @see StatementCallback 033 */ 034public interface SqlProvider { 035 036 /** 037 * Return the SQL string for this object, i.e. 038 * typically the SQL used for creating statements. 039 * @return the SQL string, or {@code null} if not available 040 */ 041 @Nullable 042 String getSql(); 043 044}