1 /** 2 * Copyright 2009-2019 the original author or authors. 3 * 4 * Licensed under the Apache License, Version 2.0 (the "License"); 5 * you may not use this file except in compliance with the License. 6 * You may obtain a copy of the License at 7 * 8 * http://www.apache.org/licenses/LICENSE-2.0 9 * 10 * Unless required by applicable law or agreed to in writing, software 11 * distributed under the License is distributed on an "AS IS" BASIS, 12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 * See the License for the specific language governing permissions and 14 * limitations under the License. 15 */ 16 package org.apache.ibatis.builder.annotation; 17 18 import java.lang.reflect.Method; 19 20 /** 21 * The context object for sql provider method. 22 * 23 * @author Kazuki Shimizu 24 * @since 3.4.5 25 */ 26 public final class ProviderContext { 27 28 private final Class<?> mapperType; 29 private final Method mapperMethod; 30 private final String databaseId; 31 32 /** 33 * Constructor. 34 * 35 * @param mapperType A mapper interface type that specified provider 36 * @param mapperMethod A mapper method that specified provider 37 * @param databaseId A database id 38 */ 39 ProviderContext(Class<?> mapperType, Method mapperMethod, String databaseId) { 40 this.mapperType = mapperType; 41 this.mapperMethod = mapperMethod; 42 this.databaseId = databaseId; 43 } 44 45 /** 46 * Get a mapper interface type that specified provider. 47 * 48 * @return A mapper interface type that specified provider 49 */ 50 public Class<?> getMapperType() { 51 return mapperType; 52 } 53 54 /** 55 * Get a mapper method that specified provider. 56 * 57 * @return A mapper method that specified provider 58 */ 59 public Method getMapperMethod() { 60 return mapperMethod; 61 } 62 63 /** 64 * Get a database id that provided from {@link org.apache.ibatis.mapping.DatabaseIdProvider}. 65 * 66 * @return A database id 67 * @since 3.5.1 68 */ 69 public String getDatabaseId() { 70 return databaseId; 71 } 72 73 }