All Downloads are FREE. Search and download functionalities are using the official Maven repository.

cloud.prefab.client.config.ConfigStoreImpl Maven / Gradle / Ivy

Go to download

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);
  }
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy