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 description.withDisplayName
(String displayName) Sets the displayName.Sets the name.withOptionalDescription
(String description) Sets the description.withOptionalDisplayName
(String displayName) Sets the displayName.withOptionalType
(MetricType type) Sets the type.withOptionalUnit
(String unit) Sets the unit.withType
(MetricType type) Sets the type.Sets the unit.
-
Constructor Details
-
MetadataBuilder
public MetadataBuilder()
-
-
Method Details
-
withName
Sets the name. Does not accept null.- Parameters:
name
- the name- Returns:
- the builder instance
- Throws:
NullPointerException
- when name is null
-
withDisplayName
Sets the displayName. Does not accept null.- Parameters:
displayName
- the displayName- Returns:
- the builder instance
- Throws:
NullPointerException
- when displayName is null
-
withOptionalDisplayName
Sets the displayName. Does accept null.- Parameters:
displayName
- the displayName- Returns:
- the builder instance
-
withDescription
Sets the description. Does not accept null.- Parameters:
description
- the name- Returns:
- the builder instance
- Throws:
NullPointerException
- when description is null
-
withOptionalDescription
Sets the description. Does accept null.- Parameters:
description
- the name- Returns:
- the builder instance
-
withType
Sets the type. Does not accept null.- Parameters:
type
- the type- Returns:
- the builder instance
- Throws:
NullPointerException
- when type is null
-
withOptionalType
Sets the type. Does accept null.- Parameters:
type
- the type- Returns:
- the builder instance
-
withUnit
Sets the unit. Does not accept null.- Parameters:
unit
- the unit- Returns:
- the builder instance
- Throws:
NullPointerException
- when unit is null
-
withOptionalUnit
Sets the unit. Does accept null.- Parameters:
unit
- the unit- Returns:
- the builder instance
-
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
-