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

org.infinispan.commons.stat.BaseMetricInfo Maven / Gradle / Ivy

There is a newer version: 15.1.0.Dev04
Show newest version
package org.infinispan.commons.stat;

import java.util.Collections;
import java.util.Map;
import java.util.Objects;

/**
 * Base implementation of {@link MetricInfo} with all the required information.
 *
 * @since 15.0
 */
abstract class BaseMetricInfo implements MetricInfo {

   private final String name;
   private final String description;
   private final Map map;

   BaseMetricInfo(String name, String description, Map map) {
      this.name = Objects.requireNonNull(name);
      this.description = Objects.requireNonNull(description);
      this.map = map == null || map.isEmpty() ? Collections.emptyMap() : Map.copyOf(map);
   }

   @Override
   public final String getName() {
      return name;
   }

   @Override
   public final String getDescription() {
      return description;
   }

   @Override
   public final Map getTags() {
      return map;
   }

   @Override
   public String toString() {
      return getClass().getSimpleName() + "{" +
            "name='" + getName() + '\'' +
            ", description='" + getDescription() + '\'' +
            ", tags=" + getTags() +
            '}';
   }
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy