Package org.eclipse.microprofile.metrics

## Class MetadataBuilder

- java.lang.Object
- - org.eclipse.microprofile.metrics.MetadataBuilder

    public class MetadataBuilder
    extends Object

The `Metadata` builder. All values are considered "not present" by default. Name must be set before `build()` is called.

### Constructor Summary

Constructors
`MetadataBuilder()`

### Method Summary

All Methods Instance Methods Concrete Methods
`Metadata` `build()`
`MetadataBuilder` `withDescription​(String description)` Sets the description.
`MetadataBuilder` `withName​(String name)` Sets the name.
`MetadataBuilder` `withUnit​(String unit)` Sets the unit.

### Methods inherited from class java.lang.Object

`clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

### Constructor Detail

#### MetadataBuilder

    public MetadataBuilder()

### 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 null
  `IllegalArgumentException` - 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.NONE` is considered as "not present" (null)
Returns:
  the builder instance

#### build

    public Metadata build()

Returns:
  An object implementing `Metadata` from the provided properties
Throws:
  `IllegalStateException` - when either name is null