View Javadoc
1   /*
2    *    Copyright 2009-2021 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
36     *          A mapper interface type that specified provider
37     * @param mapperMethod
38     *          A mapper method that specified provider
39     * @param databaseId
40     *          A database id
41     */
42    ProviderContext(Class<?> mapperType, Method mapperMethod, String databaseId) {
43      this.mapperType = mapperType;
44      this.mapperMethod = mapperMethod;
45      this.databaseId = databaseId;
46    }
47  
48    /**
49     * Get a mapper interface type that specified provider.
50     *
51     * @return A mapper interface type that specified provider
52     */
53    public Class<?> getMapperType() {
54      return mapperType;
55    }
56  
57    /**
58     * Get a mapper method that specified provider.
59     *
60     * @return A mapper method that specified provider
61     */
62    public Method getMapperMethod() {
63      return mapperMethod;
64    }
65  
66    /**
67     * Get a database id that provided from {@link org.apache.ibatis.mapping.DatabaseIdProvider}.
68     *
69     * @return A database id
70     * @since 3.5.1
71     */
72    public String getDatabaseId() {
73      return databaseId;
74    }
75  
76  }