ResultMapResolver.java

  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. import java.util.List;

  18. import org.apache.ibatis.mapping.Discriminator;
  19. import org.apache.ibatis.mapping.ResultMap;
  20. import org.apache.ibatis.mapping.ResultMapping;

  21. /**
  22.  * @author Eduardo Macarron
  23.  */
  24. public class ResultMapResolver {
  25.   private final MapperBuilderAssistant assistant;
  26.   private final String id;
  27.   private final Class<?> type;
  28.   private final String extend;
  29.   private final Discriminator discriminator;
  30.   private final List<ResultMapping> resultMappings;
  31.   private final Boolean autoMapping;

  32.   public ResultMapResolver(MapperBuilderAssistant assistant, String id, Class<?> type, String extend,
  33.       Discriminator discriminator, List<ResultMapping> resultMappings, Boolean autoMapping) {
  34.     this.assistant = assistant;
  35.     this.id = id;
  36.     this.type = type;
  37.     this.extend = extend;
  38.     this.discriminator = discriminator;
  39.     this.resultMappings = resultMappings;
  40.     this.autoMapping = autoMapping;
  41.   }

  42.   public ResultMap resolve() {
  43.     return assistant.addResultMap(this.id, this.type, this.extend, this.discriminator, this.resultMappings,
  44.         this.autoMapping);
  45.   }

  46. }