cloud.prefab.client.config.ConfigStoreImpl Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of prefab-cloud-java Show documentation
Show all versions of prefab-cloud-java Show documentation
API Client for https://prefab.cloud: rate limits, feature flags and semaphores as a service
The newest version!
package cloud.prefab.client.config;
import cloud.prefab.client.ConfigStore;
import com.google.common.collect.ImmutableMap;
import com.google.common.collect.ImmutableSet;
import java.util.Collection;
import java.util.Map;
import java.util.concurrent.atomic.AtomicReference;
public class ConfigStoreImpl implements ConfigStore {
private final AtomicReference> localMap = new AtomicReference<>(
ImmutableMap.of()
);
@Override
public Collection getKeys() {
return localMap.get().keySet();
}
public ImmutableSet> entrySet() {
return localMap.get().entrySet();
}
public void set(ImmutableMap newData) {
localMap.set(newData);
}
@Override
public ConfigElement getElement(String key) {
return localMap.get().get(key);
}
@Override
public boolean containsKey(String key) {
return localMap.get().containsKey(key);
}
}