Java Code Examples for com.typesafe.config.Config#getEnum()

The following examples show how to use com.typesafe.config.Config#getEnum() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: ProxyRouteConfig.java    From xio with Apache License 2.0 5 votes vote down vote up
public ProxyRouteConfig(Config config) {
  super(config);
  // validatePath(config.getString("path"), config.origin());
  endsWith(config, "path", "/");
  //    List<Config> foo = config.getConfigList("clients");
  // clientConfigs = buildClientConfigs(foo);
  clientConfigs = buildClientConfigs((List<Config>) config.getConfigList("clients"));
  // clientConfigs = buildClientConfigs(new ArrayList<>());
  proxyHostPolicy = config.getEnum(ProxyHostPolicy.class, "proxyHostPolicy");
  proxyHost = config.getString("proxyHost");
  proxyPath = startsWith(config, "proxyPath", "/");
  endsWith(config, "proxyPath", "/");
  // validatePath(config.getString("proxyPath"), config.origin());
}
 
Example 2
Source File: TracingConfig.java    From xio with Apache License 2.0 5 votes vote down vote up
public TracingConfig(String applicationName, Config config) {
  this.applicationName = applicationName;

  TracingType type;
  if (config.hasPath("type")) {
    type = config.getEnum(TracingType.class, "type");
  } else {
    type = TracingType.ZIPKIN;
  }
  this.type = type;

  if (type == TracingType.ZIPKIN) {
    String zipkinUrl;
    if (config.hasPath("zipkin.zipkinUrl")) {
      zipkinUrl = config.getString("zipkin.zipkinUrl");
    } else {
      zipkinUrl = "";
    }

    float samplingRate;
    if (config.hasPath("zipkin.samplingRate")) {
      samplingRate = ((Double) config.getDouble("zipkin.samplingRate")).floatValue();
    } else {
      samplingRate = 0.01f;
    }

    this.zipkinUrl = zipkinUrl;
    this.zipkinSamplingRate = samplingRate;
  }
}
 
Example 3
Source File: TlsConfig.java    From xio with Apache License 2.0 5 votes vote down vote up
private static ApplicationProtocolConfig buildAlpnConfig(Config config) {
  ApplicationProtocolConfig.Protocol protocol =
      config.getEnum(ApplicationProtocolConfig.Protocol.class, "protocol");
  ApplicationProtocolConfig.SelectorFailureBehavior selectorBehavior =
      config.getEnum(ApplicationProtocolConfig.SelectorFailureBehavior.class, "selectorBehavior");
  ApplicationProtocolConfig.SelectedListenerFailureBehavior selectedBehavior =
      config.getEnum(
          ApplicationProtocolConfig.SelectedListenerFailureBehavior.class, "selectedBehavior");
  List<String> supportedProtocols = config.getStringList("supportedProtocols");
  return new ApplicationProtocolConfig(
      protocol, selectorBehavior, selectedBehavior, supportedProtocols);
}
 
Example 4
Source File: StoreConfig.java    From distkv with BSD 3-Clause "New" or "Revised" License 4 votes vote down vote up
public StoreConfig(Config config) {
  listeningPort = config.getInt("store.listeningPort");
  shardsNum = config.getInt("store.shardsNum");
  metaServerAddresses = config.getString("store.metaServerAddresses");
  mode = config.getEnum(RunningMode.class, "store.mode");
}