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