View Javadoc
1   /*
2    *    Copyright 2009-2023 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    *       https://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;
17  
18  import java.util.List;
19  
20  import org.apache.ibatis.mapping.Discriminator;
21  import org.apache.ibatis.mapping.ResultMap;
22  import org.apache.ibatis.mapping.ResultMapping;
23  
24  /**
25   * @author Eduardo Macarron
26   */
27  public class ResultMapResolver {
28    private final MapperBuilderAssistant assistant;
29    private final String id;
30    private final Class<?> type;
31    private final String extend;
32    private final Discriminator discriminator;
33    private final List<ResultMapping> resultMappings;
34    private final Boolean autoMapping;
35  
36    public ResultMapResolver(MapperBuilderAssistant assistant, String id, Class<?> type, String extend,
37        Discriminator discriminator, List<ResultMapping> resultMappings, Boolean autoMapping) {
38      this.assistant = assistant;
39      this.id = id;
40      this.type = type;
41      this.extend = extend;
42      this.discriminator = discriminator;
43      this.resultMappings = resultMappings;
44      this.autoMapping = autoMapping;
45    }
46  
47    public ResultMap resolve() {
48      return assistant.addResultMap(this.id, this.type, this.extend, this.discriminator, this.resultMappings,
49          this.autoMapping);
50    }
51  
52  }