Package org.eclipse.microprofile.metrics
Class MetadataBuilder
java.lang.Object
org.eclipse.microprofile.metrics.MetadataBuilder
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionbuild()
withDescription
(String description) Sets the description.withDisplayName
(String displayName) Sets the displayName.Sets the name.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 nullIllegalArgumentException
- when name is empty
-
withDisplayName
Sets the displayName.- Parameters:
displayName
- the displayName, empty string is considered as "not present" (null)- Returns:
- the builder instance
-
withDescription
Sets the description.- Parameters:
description
- the name, empty string is considered as "not present" (null)- Returns:
- the builder instance
-
withType
Sets the type.- Parameters:
type
- the type,MetricType.INVALID
is considered as "not present" (null)- Returns:
- the builder instance
-
withUnit
Sets the unit.- Parameters:
unit
- the unit,MetricUnits.NONE
is considered as "not present" (null)- Returns:
- the builder instance
-
build
- Returns:
- An object implementing
Metadata
from the provided properties - Throws:
IllegalStateException
- when either name is null
-