Class ImmutableMetricDescriptor

java.lang.Object
org.opendaylight.serviceutils.metrics.MetricDescriptor
org.opendaylight.serviceutils.metrics.ImmutableMetricDescriptor

@Generated("org.immutables.processor.ProxyProcessor") public final class ImmutableMetricDescriptor extends MetricDescriptor
Immutable implementation of MetricDescriptor.

Use the builder to create immutable instances: ImmutableMetricDescriptor.builder().

  • Method Details

    • anchor

      public Object anchor()
      Instance of the class "containing" this Metric.
      Specified by:
      anchor in class MetricDescriptor
    • project

      public String project()
      Name of OpenDaylight project the Metric is for, unique at opendaylight.org. E.g. "netvirt" or "genius" or "openflowplugin" or "infrautils" etc. The project/module/id together must be unique within ODL. Valid values match [a-z0-9]+ (lower case and no dots nor underscores).
      Specified by:
      project in class MetricDescriptor
    • module

      public String module()
      Name of OpenDaylight module the Metric is for, unique within given project(). E.g. "vpnmanager" or "lockmanager" or "jobcoordinator" etc. The project/module/id together must be unique within ODL. Valid values match [a-z0-9]+ (lower case and no dots nor underscores).
      Specified by:
      module in class MetricDescriptor
    • id

      public String id()
      ID of the Metric, unique within given project() + module(). E.g. "jobsPending" or "dropped_packets" or "traffic" etc. The project/module/id together must be unique within ODL. Valid values match [a-zA-Z0-9_]+ (lower and upper case and underscore allowed, but not starting with). The dot character is not allowed here because at least one of the implementations (Prometheus.io) does not accept dots in its IDs.
      Specified by:
      id in class MetricDescriptor
    • description

      public String description()
      Human readable description of the Metric. E.g. "Counts the number of bla bla bla". No validation of valid values; anything goes. Defaults to be the same as id(); but highly recommended to be set so that external Dashboard type UIs can show it as documentation or help for this Metric.
      Overrides:
      description in class MetricDescriptor
    • withAnchor

      public final ImmutableMetricDescriptor withAnchor(Object value)
      Copy the current immutable object by setting a value for the anchor attribute. A shallow reference equality check is used to prevent copying of the same value by returning this.
      Parameters:
      value - A new value for anchor
      Returns:
      A modified copy of the this object
    • withProject

      public final ImmutableMetricDescriptor withProject(String value)
      Copy the current immutable object by setting a value for the project attribute. An equals check used to prevent copying of the same value by returning this.
      Parameters:
      value - A new value for project
      Returns:
      A modified copy of the this object
    • withModule

      public final ImmutableMetricDescriptor withModule(String value)
      Copy the current immutable object by setting a value for the module attribute. An equals check used to prevent copying of the same value by returning this.
      Parameters:
      value - A new value for module
      Returns:
      A modified copy of the this object
    • withId

      public final ImmutableMetricDescriptor withId(String value)
      Copy the current immutable object by setting a value for the id attribute. An equals check used to prevent copying of the same value by returning this.
      Parameters:
      value - A new value for id
      Returns:
      A modified copy of the this object
    • withDescription

      public final ImmutableMetricDescriptor withDescription(String value)
      Copy the current immutable object by setting a value for the description attribute. An equals check used to prevent copying of the same value by returning this.
      Parameters:
      value - A new value for description
      Returns:
      A modified copy of the this object
    • equals

      public boolean equals(Object another)
      This instance is equal to all instances of ImmutableMetricDescriptor that have equal attribute values.
      Overrides:
      equals in class Object
      Returns:
      true if this is equal to another instance
    • hashCode

      public int hashCode()
      Computes a hash code from attributes: anchor, project, module, id, description.
      Overrides:
      hashCode in class Object
      Returns:
      hashCode value
    • toString

      public String toString()
      Prints the immutable value MetricDescriptor with attribute values.
      Overrides:
      toString in class Object
      Returns:
      A string representation of the value
    • copyOf

      public static ImmutableMetricDescriptor copyOf(MetricDescriptor instance)
      Creates an immutable copy of a MetricDescriptor value. Uses accessors to get values to initialize the new immutable instance. If an instance is already immutable, it is returned as is.
      Parameters:
      instance - The instance to copy
      Returns:
      A copied immutable MetricDescriptor instance
    • builder

      Creates a builder for ImmutableMetricDescriptor.
       ImmutableMetricDescriptor.builder()
          .anchor(Object) // required anchor
          .project(String) // required project
          .module(String) // required module
          .id(String) // required id
          .description(String) // optional description
          .build();
       
      Returns:
      A new ImmutableMetricDescriptor builder