Snowplow Android Tracker 3.1.2
GlobalContextsConfiguration.java
Go to the documentation of this file.
1package com.snowplowanalytics.snowplow.configuration;
2
3import androidx.annotation.NonNull;
4import androidx.annotation.Nullable;
5
6import com.snowplowanalytics.snowplow.globalcontexts.GlobalContext;
7import com.snowplowanalytics.snowplow.internal.globalcontexts.GlobalContextsConfigurationInterface;
8
9import java.util.HashMap;
10import java.util.Map;
11import java.util.Set;
12
17
18 @NonNull
19 public final Map<String, GlobalContext> contextGenerators;
20
21 // Constructors
22
28 public GlobalContextsConfiguration(@Nullable Map<String, GlobalContext> contextGenerators) {
29 this.contextGenerators = contextGenerators != null ? contextGenerators : new HashMap<>();
30 }
31
32 // Methods
33
37 @NonNull
38 @Override
39 public Set<String> getTags() {
40 return contextGenerators.keySet();
41 }
42
49 @Override
50 public boolean add(@NonNull String tag, @NonNull GlobalContext contextGenerator) {
51 if (contextGenerators.get(tag) != null) {
52 return false;
53 }
54 contextGenerators.put(tag, contextGenerator);
55 return true;
56 }
57
63 @Override
64 @Nullable
65 public GlobalContext remove(@NonNull String tag) {
66 return contextGenerators.remove(tag);
67 }
68
69 // Copyable
70
71 @Override
72 @NonNull
75 }
76}
GlobalContextsConfiguration(@Nullable Map< String, GlobalContext > contextGenerators)
boolean add(@NonNull String tag, @NonNull GlobalContext contextGenerator)