Package org.eclipse.microprofile.metrics
Class MetadataBuilder
java.lang.Object
org.eclipse.microprofile.metrics.MetadataBuilder
The
Metadata
builder.
This builder has a default value:
type
as MetricType.INVALID
unit
as MetricUnits.NONE
reusable
as Boolean.FALSE
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionbuild()
Sets the reusability flag toBoolean.FALSE
reusable()
Sets the reusability flag toBoolean.TRUE
reusable
(boolean value) Sets the reusability flag to the desired boolean valuewithDescription
(String description) Sets the descriptionwithDisplayName
(String displayName) Sets the displayNameSets the namewithType
(MetricType type) Sets the typeSets the unit
-
Constructor Details
-
MetadataBuilder
public MetadataBuilder()
-
-
Method Details
-
withName
Sets the name- Parameters:
name
- the name- Returns:
- the builder instance
- Throws:
NullPointerException
- when name is null
-
withDisplayName
Sets the displayName- Parameters:
displayName
- the displayName- Returns:
- the builder instance
- Throws:
NullPointerException
- when displayName is null
-
withDescription
Sets the description- Parameters:
description
- the name- Returns:
- the builder instance
- Throws:
NullPointerException
- when description is null
-
withType
Sets the type- Parameters:
type
- the name- Returns:
- the builder instance
- Throws:
NullPointerException
- when type is null
-
withUnit
Sets the unit- Parameters:
unit
- the name- Returns:
- the builder instance
- Throws:
NullPointerException
- when unit is null
-
reusable
Sets the reusability flag toBoolean.TRUE
- Returns:
- the builder instance
-
reusable
Sets the reusability flag to the desired boolean value- Parameters:
value
- the value of the reusability flag- Returns:
- the builder instance
-
notReusable
Sets the reusability flag toBoolean.FALSE
- Returns:
- the builder instance
-
build
- Returns:
- An object implementing
Metadata
from the provided properties - Throws:
IllegalStateException
- when either name is null
-