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

cloud.prefab.client.value.LiveStringList Maven / Gradle / Ivy

Go to download

API Client for https://prefab.cloud: rate limits, feature flags and semaphores as a service

There is a newer version: 0.3.23
Show newest version
package cloud.prefab.client.value;

import cloud.prefab.client.ConfigClient;
import cloud.prefab.domain.Prefab;
import java.util.List;
import java.util.Optional;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

public class LiveStringList extends AbstractLiveValue> {

  private static final Logger LOG = LoggerFactory.getLogger(LiveStringList.class);

  public LiveStringList(ConfigClient configClient, String key) {
    super(configClient, key);
  }

  @Override
  public Optional> resolve(Prefab.ConfigValue value) {
    if (value.hasStringList()) {
      return Optional.of(value.getStringList().getValuesList());
    } else {
      LOG.warn(
        String.format(
          "Config value for key '%s' used as a stringlist does not have a string value, will treat as empty",
          key
        )
      );
      return Optional.empty();
    }
  }
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy