Class MetadataBuilder


  • public class MetadataBuilder
    extends java.lang.Object
    The Metadata builder. All values are considered "not present" by default. Name must be set before build() is called.
    • Constructor Detail

      • MetadataBuilder

        public MetadataBuilder()
    • Method Detail

      • withName

        public MetadataBuilder withName​(java.lang.String name)
        Sets the name. Does not accept null.
        Parameters:
        name - the name
        Returns:
        the builder instance
        Throws:
        java.lang.NullPointerException - when name is null
        java.lang.IllegalArgumentException - when name is empty
      • withDisplayName

        public MetadataBuilder withDisplayName​(java.lang.String displayName)
        Sets the displayName.
        Parameters:
        displayName - the displayName, empty string is considered as "not present" (null)
        Returns:
        the builder instance
      • withDescription

        public MetadataBuilder withDescription​(java.lang.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​(java.lang.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:
        java.lang.IllegalStateException - when either name is null