Package org.eclipse.microprofile.metrics
Class MetadataBuilder
- java.lang.Object
-
- org.eclipse.microprofile.metrics.MetadataBuilder
-
public class MetadataBuilder extends Object
-
-
Constructor Summary
Constructors Constructor Description MetadataBuilder()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description Metadatabuild()MetadataBuilderwithDescription(String description)Sets the description.MetadataBuilderwithName(String name)Sets the name.MetadataBuilderwithUnit(String unit)Sets the unit.
-
-
-
Method Detail
-
withName
public MetadataBuilder withName(String name)
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
-
withDescription
public MetadataBuilder withDescription(String description)
Sets the description.- Parameters:
description- the name, empty string is considered as "not present" (null)- Returns:
- the builder instance
-
withUnit
public MetadataBuilder withUnit(String unit)
Sets the unit.- Parameters:
unit- the unit,MetricUnits.NONEis considered as "not present" (null)- Returns:
- the builder instance
-
build
public Metadata build()
- Returns:
- An object implementing
Metadatafrom the provided properties - Throws:
IllegalStateException- when either name is null
-
-