Class MetadataBuilder

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

public class MetadataBuilder extends Object
The Metadata builder. This builder has a default value: type as MetricType.INVALID unit as MetricUnits.NONE reusable as Boolean.FALSE
  • Constructor Details

    • MetadataBuilder

      public MetadataBuilder()
  • Method Details

    • withName

      public MetadataBuilder withName(String name)
      Sets the name
      Parameters:
      name - the name
      Returns:
      the builder instance
      Throws:
      NullPointerException - when name is null
    • withDisplayName

      public MetadataBuilder withDisplayName(String displayName)
      Sets the displayName
      Parameters:
      displayName - the displayName
      Returns:
      the builder instance
      Throws:
      NullPointerException - when displayName is null
    • withDescription

      public MetadataBuilder withDescription(String description)
      Sets the description
      Parameters:
      description - the name
      Returns:
      the builder instance
      Throws:
      NullPointerException - when description is null
    • withType

      public MetadataBuilder withType(MetricType type)
      Sets the type
      Parameters:
      type - the name
      Returns:
      the builder instance
      Throws:
      NullPointerException - when type is null
    • withUnit

      public MetadataBuilder withUnit(String unit)
      Sets the unit
      Parameters:
      unit - the name
      Returns:
      the builder instance
      Throws:
      NullPointerException - when unit is null
    • reusable

      public MetadataBuilder reusable()
      Sets the reusability flag to Boolean.TRUE
      Returns:
      the builder instance
    • reusable

      public MetadataBuilder reusable(boolean value)
      Sets the reusability flag to the desired boolean value
      Parameters:
      value - the value of the reusability flag
      Returns:
      the builder instance
    • notReusable

      public MetadataBuilder notReusable()
      Sets the reusability flag to Boolean.FALSE
      Returns:
      the builder instance
    • build

      public Metadata build()
      Returns:
      An object implementing Metadata from the provided properties
      Throws:
      IllegalStateException - when either name is null