org.eclipse.microprofile.metrics

## Class DefaultMetadata

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

All Implemented Interfaces:
  Metadata

    public class DefaultMetadata
    extends Object
    implements Metadata

The default implementation of `Metadata`

### Constructor Summary

Constructors
`protected` `DefaultMetadata(String name, String displayName, String description, MetricType type, String unit)`

### Method Summary

All Methods Instance Methods Concrete Methods
`Optional<String>` `description()`
`Optional<String>` `displayName()`
`boolean` `equals(Object o)`
`String` `getDescription()` Returns the description of the metric if set, otherwise this method returns the empty `String`.
`String` `getDisplayName()` Returns the display name if set, otherwise this method returns the metric name.
`String` `getName()` Returns the metric name.
`String` `getType()` Returns the String representation of the `MetricType`.
`MetricType` `getTypeRaw()` Returns the `MetricType` of the metric if set, otherwise it returns `MetricType.INVALID`
`String` `getUnit()` Returns the unit of this metric if set, otherwise this method returns `MetricUnits.NONE`
`int` `hashCode()`
`String` `toString()`
`Optional<String>` `unit()`

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

`clone, finalize, getClass, notify, notifyAll, wait, wait, wait`

### Methods inherited from interface org.eclipse.microprofile.metrics.Metadata

`builder, builder`

### Constructor Detail

#### DefaultMetadata

    protected DefaultMetadata(String name,
                              String displayName,
                              String description,
                              MetricType type,
                              String unit)

### Method Detail

#### getName

    public String getName()

Description copied from interface: `Metadata`
Returns the metric name.

Specified by:
  `getName` in interface `Metadata`
Returns:
  the metric name.

#### getDisplayName

    public String getDisplayName()

Description copied from interface: `Metadata`
Returns the display name if set, otherwise this method returns the metric name.

Specified by:
  `getDisplayName` in interface `Metadata`
Returns:
  the display name

#### displayName

    public Optional<String> displayName()

Specified by:
  `displayName` in interface `Metadata`

#### getDescription

    public String getDescription()

Description copied from interface: `Metadata`
Returns the description of the metric if set, otherwise this method returns the empty `String`.

Specified by:
  `getDescription` in interface `Metadata`
Returns:
  the description

#### description

    public Optional<String> description()

Specified by:
  `description` in interface `Metadata`

#### getType

    public String getType()

Description copied from interface: `Metadata`
Returns the String representation of the `MetricType`.

Specified by:
  `getType` in interface `Metadata`
Returns:
  the MetricType as a String
See Also:
  `MetricType`

#### getTypeRaw

    public MetricType getTypeRaw()

Description copied from interface: `Metadata`
Returns the `MetricType` of the metric if set, otherwise it returns `MetricType.INVALID`

Specified by:
  `getTypeRaw` in interface `Metadata`
Returns:
  the `MetricType`

#### getUnit

    public String getUnit()

Description copied from interface: `Metadata`
Returns the unit of this metric if set, otherwise this method returns `MetricUnits.NONE`

Specified by:
  `getUnit` in interface `Metadata`
Returns:
  the unit

#### unit

    public Optional<String> unit()

Specified by:
  `unit` in interface `Metadata`

#### equals

    public boolean equals(Object o)

Overrides:
  `equals` in class `Object`

#### hashCode

    public int hashCode()

Overrides:
  `hashCode` in class `Object`

#### toString

    public String toString()

Overrides:
  `toString` in class `Object`