001/* 002 * Copyright 2002-2016 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.support; 018 019import java.sql.DatabaseMetaData; 020import java.sql.SQLException; 021 022/** 023 * A callback interface used by the JdbcUtils class. Implementations of this 024 * interface perform the actual work of extracting database meta-data, but 025 * don't need to worry about exception handling. SQLExceptions will be caught 026 * and handled correctly by the JdbcUtils class. 027 * 028 * @author Thomas Risberg 029 * @see JdbcUtils#extractDatabaseMetaData 030 */ 031public interface DatabaseMetaDataCallback { 032 033 /** 034 * Implementations must implement this method to process the meta-data 035 * passed in. Exactly what the implementation chooses to do is up to it. 036 * @param dbmd the DatabaseMetaData to process 037 * @return a result object extracted from the meta-data 038 * (can be an arbitrary object, as needed by the implementation) 039 * @throws SQLException if a SQLException is encountered getting 040 * column values (that is, there's no need to catch SQLException) 041 * @throws MetaDataAccessException in case of other failures while 042 * extracting meta-data (for example, reflection failure) 043 */ 044 Object processMetaData(DatabaseMetaData dbmd) throws SQLException, MetaDataAccessException; 045 046}