1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19 package org.apache.maven.extension.internal;
20
21 import static java.util.function.Function.identity;
22 import static java.util.stream.Collectors.collectingAndThen;
23 import static java.util.stream.Collectors.toMap;
24
25 import java.util.Collections;
26 import java.util.HashSet;
27 import java.util.Map;
28 import java.util.Set;
29 import org.codehaus.plexus.classworlds.realm.ClassRealm;
30
31
32
33
34
35
36
37 public class CoreExports {
38 private final Set<String> artifacts;
39
40 private final Map<String, ClassLoader> packages;
41
42 public CoreExports(CoreExtensionEntry entry) {
43 this(entry.getClassRealm(), entry.getExportedArtifacts(), entry.getExportedPackages());
44 }
45
46 public CoreExports(ClassRealm realm, Set<String> exportedArtifacts, Set<String> exportedPackages) {
47 this.artifacts = Collections.unmodifiableSet(new HashSet<>(exportedArtifacts));
48 this.packages = exportedPackages.stream()
49 .collect(collectingAndThen(toMap(identity(), v -> realm), Collections::unmodifiableMap));
50 }
51
52
53
54
55
56 public Set<String> getExportedArtifacts() {
57 return artifacts;
58 }
59
60
61
62
63 public Map<String, ClassLoader> getExportedPackages() {
64 return packages;
65 }
66 }