1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16 package org.apache.ibatis.mapping;
17
18 import java.util.Collections;
19 import java.util.Map;
20
21 import org.apache.ibatis.session.Configuration;
22
23
24
25
26 public class Discriminator {
27
28 private ResultMapping resultMapping;
29 private Map<String, String> discriminatorMap;
30
31 Discriminator() {
32 }
33
34 public static class Builder {
35 private Discriminatorml#Discriminator">Discriminator discriminator = new Discriminator();
36
37 public Builder(Configuration configuration, ResultMapping resultMapping, Map<String, String> discriminatorMap) {
38 discriminator.resultMapping = resultMapping;
39 discriminator.discriminatorMap = discriminatorMap;
40 }
41
42 public Discriminator build() {
43 assert discriminator.resultMapping != null;
44 assert discriminator.discriminatorMap != null;
45 assert !discriminator.discriminatorMap.isEmpty();
46
47 discriminator.discriminatorMap = Collections.unmodifiableMap(discriminator.discriminatorMap);
48 return discriminator;
49 }
50 }
51
52 public ResultMapping getResultMapping() {
53 return resultMapping;
54 }
55
56 public Map<String, String> getDiscriminatorMap() {
57 return discriminatorMap;
58 }
59
60 public String getMapIdFor(String s) {
61 return discriminatorMap.get(s);
62 }
63
64 }