Package org.eclipse.microprofile.metrics
Interface Metadata
-
- All Known Implementing Classes:
DefaultMetadata
public interface Metadata
Bean holding the metadata of one single metric.The metadata contains:
Name
: (Required) The name of the metric.Display name
: (Optional) The display (friendly) name of the metric. By default, it is set to theName
.Description
: (Optional) A human readable description of the metric.Type
: (Required) The type of the metric. SeeMetricType
.Unit
: (Optional) The unit of the metric. The unit may be any unit specified as a String or one specified inMetricUnits
.
-
-
Method Summary
All Methods Static Methods Instance Methods Abstract Methods Modifier and Type Method Description static MetadataBuilder
builder()
Returns a new builderstatic MetadataBuilder
builder(Metadata metadata)
Returns a new builder with theMetadata
informationjava.util.Optional<java.lang.String>
description()
java.util.Optional<java.lang.String>
displayName()
java.lang.String
getDescription()
Returns the description of the metric if set, otherwise this method returns the emptyString
.java.lang.String
getDisplayName()
Returns the display name if set, otherwise this method returns the metric name.java.lang.String
getName()
Returns the metric name.java.lang.String
getType()
Returns the String representation of theMetricType
.MetricType
getTypeRaw()
Returns theMetricType
of the metric if set, otherwise it returnsMetricType.INVALID
java.lang.String
getUnit()
Returns the unit of this metric if set, otherwise this method returnsMetricUnits.NONE
java.util.Optional<java.lang.String>
unit()
-
-
-
Method Detail
-
getName
java.lang.String getName()
Returns the metric name.- Returns:
- the metric name.
-
getDisplayName
java.lang.String getDisplayName()
Returns the display name if set, otherwise this method returns the metric name.- Returns:
- the display name
-
displayName
java.util.Optional<java.lang.String> displayName()
-
getDescription
java.lang.String getDescription()
Returns the description of the metric if set, otherwise this method returns the emptyString
.- Returns:
- the description
-
description
java.util.Optional<java.lang.String> description()
-
getType
java.lang.String getType()
Returns the String representation of theMetricType
.- Returns:
- the MetricType as a String
- See Also:
MetricType
-
getTypeRaw
MetricType getTypeRaw()
Returns theMetricType
of the metric if set, otherwise it returnsMetricType.INVALID
- Returns:
- the
MetricType
-
getUnit
java.lang.String getUnit()
Returns the unit of this metric if set, otherwise this method returnsMetricUnits.NONE
- Returns:
- the unit
-
unit
java.util.Optional<java.lang.String> unit()
-
builder
static MetadataBuilder builder()
Returns a new builder- Returns:
- a new
MetadataBuilder
instance
-
builder
static MetadataBuilder builder(Metadata metadata)
Returns a new builder with theMetadata
information- Parameters:
metadata
- the metadata- Returns:
- a new
MetadataBuilder
instance with theMetadata
values - Throws:
java.lang.NullPointerException
- when metadata is null
-
-