1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19 package org.eclipse.aether.internal.impl.collect;
20
21 import java.util.HashMap;
22 import java.util.Map;
23
24 import org.eclipse.aether.RepositorySystemSession;
25 import org.eclipse.aether.collection.DependencyGraphTransformationContext;
26
27 import static java.util.Objects.requireNonNull;
28
29
30
31
32
33 public class DefaultDependencyGraphTransformationContext implements DependencyGraphTransformationContext {
34
35 private final RepositorySystemSession session;
36
37 private final Map<Object, Object> map;
38
39 public DefaultDependencyGraphTransformationContext(RepositorySystemSession session) {
40 this.session = session;
41 this.map = new HashMap<>();
42 }
43
44 @Override
45 public RepositorySystemSession getSession() {
46 return session;
47 }
48
49 @Override
50 public Object get(Object key) {
51 return map.get(requireNonNull(key, "key cannot be null"));
52 }
53
54 @Override
55 public Object put(Object key, Object value) {
56 requireNonNull(key, "key cannot be null");
57 if (value != null) {
58 return map.put(key, value);
59 } else {
60 return map.remove(key);
61 }
62 }
63
64 @Override
65 public String toString() {
66 return String.valueOf(map);
67 }
68 }