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 java.util.Collections;
22 import java.util.HashSet;
23 import java.util.Map;
24 import java.util.Set;
25
26 import org.codehaus.plexus.classworlds.realm.ClassRealm;
27
28 import static java.util.function.Function.identity;
29 import static java.util.stream.Collectors.collectingAndThen;
30 import static java.util.stream.Collectors.toMap;
31
32
33
34
35
36
37
38 public class CoreExports {
39 private final Set<String> artifacts;
40
41 private final Map<String, ClassLoader> packages;
42
43 public CoreExports(CoreExtensionEntry entry) {
44 this(entry.getClassRealm(), entry.getExportedArtifacts(), entry.getExportedPackages());
45 }
46
47 public CoreExports(ClassRealm realm, Set<String> exportedArtifacts, Set<String> exportedPackages) {
48 this.artifacts = Collections.unmodifiableSet(new HashSet<>(exportedArtifacts));
49 this.packages = exportedPackages.stream()
50 .collect(collectingAndThen(toMap(identity(), v -> realm), Collections::unmodifiableMap));
51 }
52
53
54
55
56
57 public Set<String> getExportedArtifacts() {
58 return artifacts;
59 }
60
61
62
63
64 public Map<String, ClassLoader> getExportedPackages() {
65 return packages;
66 }
67 }