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

ai.vespa.metricsproxy.metric.dimensions.ApplicationDimensionsConfig Maven / Gradle / Ivy

There is a newer version: 8.441.21
Show newest version
// ------------   D O   N O T   E D I T !   ------------
// This file is generated from a config definition file.

package ai.vespa.metricsproxy.metric.dimensions;

import java.util.*;
import java.io.File;
import java.nio.file.Path;
import com.yahoo.config.*;

/**
 * This class represents the root node of application-dimensions
 *
 * Copyright Vespa.ai. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root.
 */
public final class ApplicationDimensionsConfig extends ConfigInstance {

  public final static String CONFIG_DEF_MD5 = "ddefb2a565ec67b60056bd1bd691def6";
  public final static String CONFIG_DEF_NAME = "application-dimensions";
  public final static String CONFIG_DEF_NAMESPACE = "ai.vespa.metricsproxy.metric.dimensions";
  public final static String[] CONFIG_DEF_SCHEMA = {
    "package=ai.vespa.metricsproxy.metric.dimensions",
    "dimensions{} string"
  };

  public static String getDefMd5()       { return CONFIG_DEF_MD5; }
  public static String getDefName()      { return CONFIG_DEF_NAME; }
  public static String getDefNamespace() { return CONFIG_DEF_NAMESPACE; }

  public interface Producer extends ConfigInstance.Producer {
    void getConfig(Builder builder);
  }

  public static final class Builder implements ConfigInstance.Builder {
    private Set __uninitialized = new HashSet();

    public Map dimensions = new LinkedHashMap<>();

    public Builder() { }

    public Builder(ApplicationDimensionsConfig config) {
      dimensions(config.dimensions());
    }

    private Builder override(Builder __superior) {
      dimensions(__superior.dimensions);
      return this;
    }

    public Builder dimensions(String __key, String __value) {
      dimensions.put(__key, __value);
      return this;
    }

    public Builder dimensions(Map __values) {
      dimensions.putAll(__values);
      return this;
    }

    private boolean _applyOnRestart = false;

    @java.lang.Override
    public final boolean dispatchGetConfig(ConfigInstance.Producer producer) {
      if (producer instanceof Producer) {
        ((Producer)producer).getConfig(this);
        return true;
      }
      return false;
    }

    @java.lang.Override
    public final String getDefMd5() { return CONFIG_DEF_MD5; }

    @java.lang.Override
    public final String getDefName() { return CONFIG_DEF_NAME; }

    @java.lang.Override
    public final String getDefNamespace() { return CONFIG_DEF_NAMESPACE; }

    @java.lang.Override
    public final boolean getApplyOnRestart() { return _applyOnRestart; }

    @java.lang.Override
    public final void setApplyOnRestart(boolean applyOnRestart) { _applyOnRestart = applyOnRestart; }

    public ApplicationDimensionsConfig build() {
      return new ApplicationDimensionsConfig(this);
    }

  }

  // Dimensions based on application properties
  private final Map dimensions;

  public ApplicationDimensionsConfig(Builder builder) {
    this(builder, true);
  }

  private ApplicationDimensionsConfig(Builder builder, boolean throwIfUninitialized) {
    if (throwIfUninitialized && ! builder.__uninitialized.isEmpty())
      throw new IllegalArgumentException("The following builder parameters for " +
          "application-dimensions must be initialized: " + builder.__uninitialized);

    dimensions = LeafNodeMaps.asNodeMap(builder.dimensions, new StringNode());
  }

  /**
   * @return application-dimensions.dimensions{}
   */
  public Map dimensions() {
    return LeafNodeMaps.asValueMap(dimensions);
  }

  /**
   * @param key the key of the value to return
   * @return application-dimensions.dimensions{}
   */
  public String dimensions(String key) {
    return dimensions.get(key).value();
  }

  private ChangesRequiringRestart getChangesRequiringRestart(ApplicationDimensionsConfig newConfig) {
    ChangesRequiringRestart changes = new ChangesRequiringRestart("application-dimensions");
    return changes;
  }

  private static boolean containsFieldsFlaggedWithRestart() {
    return false;
  }


}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy