Class ImmutableMetricDescriptor.Builder
- java.lang.Object
-
- org.opendaylight.serviceutils.metrics.ImmutableMetricDescriptor.Builder
-
- All Implemented Interfaces:
ImmutableMetricDescriptor.AnchorBuildStage
,ImmutableMetricDescriptor.BuildFinal
,ImmutableMetricDescriptor.IdBuildStage
,ImmutableMetricDescriptor.ModuleBuildStage
,ImmutableMetricDescriptor.ProjectBuildStage
- Enclosing class:
- ImmutableMetricDescriptor
public static final class ImmutableMetricDescriptor.Builder extends Object implements ImmutableMetricDescriptor.AnchorBuildStage, ImmutableMetricDescriptor.ProjectBuildStage, ImmutableMetricDescriptor.ModuleBuildStage, ImmutableMetricDescriptor.IdBuildStage, ImmutableMetricDescriptor.BuildFinal
Builds instances of typeImmutableMetricDescriptor
. Initialize attributes and then invoke thebuild()
method to create an immutable instance.Builder
is not thread-safe and generally should not be stored in a field or collection, but instead used immediately to create instances.
-
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description ImmutableMetricDescriptor.Builder
anchor(Object anchor)
Initializes the value for theanchor
attribute.ImmutableMetricDescriptor
build()
Builds a newImmutableMetricDescriptor
.ImmutableMetricDescriptor.Builder
description(String description)
Initializes the value for thedescription
attribute.ImmutableMetricDescriptor.Builder
id(String id)
Initializes the value for theid
attribute.ImmutableMetricDescriptor.Builder
module(String module)
Initializes the value for themodule
attribute.ImmutableMetricDescriptor.Builder
project(String project)
Initializes the value for theproject
attribute.
-
-
-
Method Detail
-
anchor
@CanIgnoreReturnValue public final ImmutableMetricDescriptor.Builder anchor(Object anchor)
Initializes the value for theanchor
attribute.- Specified by:
anchor
in interfaceImmutableMetricDescriptor.AnchorBuildStage
- Parameters:
anchor
- The value for anchor- Returns:
this
builder for use in a chained invocation
-
project
@CanIgnoreReturnValue public final ImmutableMetricDescriptor.Builder project(String project)
Initializes the value for theproject
attribute.- Specified by:
project
in interfaceImmutableMetricDescriptor.ProjectBuildStage
- Parameters:
project
- The value for project- Returns:
this
builder for use in a chained invocation
-
module
@CanIgnoreReturnValue public final ImmutableMetricDescriptor.Builder module(String module)
Initializes the value for themodule
attribute.- Specified by:
module
in interfaceImmutableMetricDescriptor.ModuleBuildStage
- Parameters:
module
- The value for module- Returns:
this
builder for use in a chained invocation
-
id
@CanIgnoreReturnValue public final ImmutableMetricDescriptor.Builder id(String id)
Initializes the value for theid
attribute.- Specified by:
id
in interfaceImmutableMetricDescriptor.IdBuildStage
- Parameters:
id
- The value for id- Returns:
this
builder for use in a chained invocation
-
description
@CanIgnoreReturnValue public final ImmutableMetricDescriptor.Builder description(String description)
Initializes the value for thedescription
attribute.If not set, this attribute will have a default value as returned by the initializer of
description
.- Specified by:
description
in interfaceImmutableMetricDescriptor.BuildFinal
- Parameters:
description
- The value for description- Returns:
this
builder for use in a chained invocation
-
build
public ImmutableMetricDescriptor build()
Builds a newImmutableMetricDescriptor
.- Specified by:
build
in interfaceImmutableMetricDescriptor.BuildFinal
- Returns:
- An immutable instance of MetricDescriptor
- Throws:
IllegalStateException
- if any required attributes are missing
-
-