Class ImmutableMetricDescriptor
- java.lang.Object
-
- org.opendaylight.infrautils.metrics.MetricDescriptor
-
- org.opendaylight.infrautils.metrics.ImmutableMetricDescriptor
-
@Generated("org.immutables.processor.ProxyProcessor") public final class ImmutableMetricDescriptor extends MetricDescriptor
Immutable implementation ofMetricDescriptor
.Use the builder to create immutable instances:
ImmutableMetricDescriptor.builder()
.
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static interface
ImmutableMetricDescriptor.AnchorBuildStage
static class
ImmutableMetricDescriptor.Builder
Builds instances of typeImmutableMetricDescriptor
.static interface
ImmutableMetricDescriptor.BuildFinal
static interface
ImmutableMetricDescriptor.IdBuildStage
static interface
ImmutableMetricDescriptor.ModuleBuildStage
static interface
ImmutableMetricDescriptor.ProjectBuildStage
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description Object
anchor()
Instance of the class "containing" this Metric.static ImmutableMetricDescriptor.AnchorBuildStage
builder()
Creates a builder forImmutableMetricDescriptor
.static ImmutableMetricDescriptor
copyOf(MetricDescriptor instance)
Creates an immutable copy of aMetricDescriptor
value.String
description()
Human readable description of the Metric.boolean
equals(Object another)
This instance is equal to all instances ofImmutableMetricDescriptor
that have equal attribute values.int
hashCode()
Computes a hash code from attributes:anchor
,project
,module
,id
,description
.String
id()
String
module()
Name of OpenDaylight module the Metric is for, unique within givenproject()
.String
project()
Name of OpenDaylight project the Metric is for, unique at opendaylight.org.String
toString()
Prints the immutable valueMetricDescriptor
with attribute values.ImmutableMetricDescriptor
withAnchor(Object value)
Copy the current immutable object by setting a value for theanchor
attribute.ImmutableMetricDescriptor
withDescription(String value)
Copy the current immutable object by setting a value for thedescription
attribute.ImmutableMetricDescriptor
withId(String value)
Copy the current immutable object by setting a value for theid
attribute.ImmutableMetricDescriptor
withModule(String value)
Copy the current immutable object by setting a value for themodule
attribute.ImmutableMetricDescriptor
withProject(String value)
Copy the current immutable object by setting a value for theproject
attribute.-
Methods inherited from class org.opendaylight.infrautils.metrics.MetricDescriptor
check
-
-
-
-
Method Detail
-
anchor
public Object anchor()
Instance of the class "containing" this Metric.- Specified by:
anchor
in classMetricDescriptor
-
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 classMetricDescriptor
-
module
public String module()
Name of OpenDaylight module the Metric is for, unique within givenproject()
. 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 classMetricDescriptor
-
id
public String id()
ID of the Metric, unique within givenproject()
+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 classMetricDescriptor
-
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 classMetricDescriptor
-
withAnchor
public final ImmutableMetricDescriptor withAnchor(Object value)
Copy the current immutable object by setting a value for theanchor
attribute. A shallow reference equality check is used to prevent copying of the same value by returningthis
.- 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 theproject
attribute. An equals check used to prevent copying of the same value by returningthis
.- 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 themodule
attribute. An equals check used to prevent copying of the same value by returningthis
.- 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 theid
attribute. An equals check used to prevent copying of the same value by returningthis
.- 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 thedescription
attribute. An equals check used to prevent copying of the same value by returningthis
.- 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 ofImmutableMetricDescriptor
that have equal attribute values.
-
hashCode
public int hashCode()
Computes a hash code from attributes:anchor
,project
,module
,id
,description
.
-
toString
public String toString()
Prints the immutable valueMetricDescriptor
with attribute values.
-
copyOf
public static ImmutableMetricDescriptor copyOf(MetricDescriptor instance)
Creates an immutable copy of aMetricDescriptor
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
public static ImmutableMetricDescriptor.AnchorBuildStage builder()
Creates a builder forImmutableMetricDescriptor
.ImmutableMetricDescriptor.builder() .anchor(Object) // required
anchor
.project(String) // requiredproject
.module(String) // requiredmodule
.id(String) // requiredid
.description(String) // optionaldescription
.build();- Returns:
- A new ImmutableMetricDescriptor builder
-
-