View Javadoc
1   /**
2    *    Copyright 2009-2015 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;
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 String id;
30    private Class<?> type;
31    private String extend;
32    private Discriminator discriminator;
33    private List<ResultMapping> resultMappings;
34    private Boolean autoMapping;
35  
36    public ResultMapResolver(MapperBuilderAssistant assistant, String id, Class<?> type, String extend, Discriminator discriminator, List<ResultMapping> resultMappings, Boolean autoMapping) {
37      this.assistant = assistant;
38      this.id = id;
39      this.type = type;
40      this.extend = extend;
41      this.discriminator = discriminator;
42      this.resultMappings = resultMappings;
43      this.autoMapping = autoMapping;
44    }
45  
46    public ResultMap resolve() {
47      return assistant.addResultMap(this.id, this.type, this.extend, this.discriminator, this.resultMappings, this.autoMapping);
48    }
49  
50  }