Class MMetadata.Builder

java.lang.Object
com.io7m.montarre.api.MMetadata.Builder
Enclosing class:
MMetadata

public static final class MMetadata.Builder extends Object
Builds instances of type MMetadata. Initialize attributes and then invoke the build() method to create an immutable instance.

Builder is not thread-safe and generally should not be stored in a field or collection, but instead used immediately to create instances.

  • Method Details

    • from

      public final MMetadata.Builder from(MMetadataType instance)
      Fill a builder with attribute values from the provided MMetadataType instance. Regular attribute values will be replaced with those from the given instance. Absent optional values will not replace present values. Collection elements and entries will be added, not replaced.
      Parameters:
      instance - The instance from which to copy values
      Returns:
      this builder for use in a chained invocation
    • setNames

      public final MMetadata.Builder setNames(MNamesType names)
      Initializes the value for the names attribute.
      Parameters:
      names - The value for names
      Returns:
      this builder for use in a chained invocation
    • setVersion

      public final MMetadata.Builder setVersion(MVersion version)
      Initializes the value for the version attribute.
      Parameters:
      version - The value for version
      Returns:
      this builder for use in a chained invocation
    • setJavaInfo

      public final MMetadata.Builder setJavaInfo(MJavaInfoType javaInfo)
      Initializes the value for the javaInfo attribute.
      Parameters:
      javaInfo - The value for javaInfo
      Returns:
      this builder for use in a chained invocation
    • setDescription

      public final MMetadata.Builder setDescription(MDescription description)
      Initializes the value for the description attribute.
      Parameters:
      description - The value for description
      Returns:
      this builder for use in a chained invocation
    • addLinks

      public final MMetadata.Builder addLinks(MLink element)
      Adds one element to links set.
      Parameters:
      element - A links element
      Returns:
      this builder for use in a chained invocation
    • addLinks

      public final MMetadata.Builder addLinks(MLink... elements)
      Adds elements to links set.
      Parameters:
      elements - An array of links elements
      Returns:
      this builder for use in a chained invocation
    • setLinks

      public final MMetadata.Builder setLinks(Iterable<? extends MLink> elements)
      Sets or replaces all elements for links set.
      Parameters:
      elements - An iterable of links elements
      Returns:
      this builder for use in a chained invocation
    • addAllLinks

      public final MMetadata.Builder addAllLinks(Iterable<? extends MLink> elements)
      Adds elements to links set.
      Parameters:
      elements - An iterable of links elements
      Returns:
      this builder for use in a chained invocation
    • setVendor

      public final MMetadata.Builder setVendor(MVendor vendor)
      Initializes the value for the vendor attribute.
      Parameters:
      vendor - The value for vendor
      Returns:
      this builder for use in a chained invocation
    • setCopying

      public final MMetadata.Builder setCopying(MCopyingType copying)
      Initializes the value for the copying attribute.
      Parameters:
      copying - The value for copying
      Returns:
      this builder for use in a chained invocation
    • addLongDescriptions

      public final MMetadata.Builder addLongDescriptions(MLongDescriptionType element)
      Adds one element to longDescriptions list.
      Parameters:
      element - A longDescriptions element
      Returns:
      this builder for use in a chained invocation
    • addLongDescriptions

      public final MMetadata.Builder addLongDescriptions(MLongDescriptionType... elements)
      Adds elements to longDescriptions list.
      Parameters:
      elements - An array of longDescriptions elements
      Returns:
      this builder for use in a chained invocation
    • setLongDescriptions

      public final MMetadata.Builder setLongDescriptions(Iterable<? extends MLongDescriptionType> elements)
      Sets or replaces all elements for longDescriptions list.
      Parameters:
      elements - An iterable of longDescriptions elements
      Returns:
      this builder for use in a chained invocation
    • addAllLongDescriptions

      public final MMetadata.Builder addAllLongDescriptions(Iterable<? extends MLongDescriptionType> elements)
      Adds elements to longDescriptions list.
      Parameters:
      elements - An iterable of longDescriptions elements
      Returns:
      this builder for use in a chained invocation
    • addCategories

      public final MMetadata.Builder addCategories(MCategoryName element)
      Adds one element to categories set.
      Parameters:
      element - A categories element
      Returns:
      this builder for use in a chained invocation
    • addCategories

      public final MMetadata.Builder addCategories(MCategoryName... elements)
      Adds elements to categories set.
      Parameters:
      elements - An array of categories elements
      Returns:
      this builder for use in a chained invocation
    • setCategories

      public final MMetadata.Builder setCategories(Iterable<? extends MCategoryName> elements)
      Sets or replaces all elements for categories set.
      Parameters:
      elements - An iterable of categories elements
      Returns:
      this builder for use in a chained invocation
    • addAllCategories

      public final MMetadata.Builder addAllCategories(Iterable<? extends MCategoryName> elements)
      Adds elements to categories set.
      Parameters:
      elements - An iterable of categories elements
      Returns:
      this builder for use in a chained invocation
    • setApplicationKind

      public final MMetadata.Builder setApplicationKind(MApplicationKind applicationKind)
      Initializes the value for the applicationKind attribute.
      Parameters:
      applicationKind - The value for applicationKind
      Returns:
      this builder for use in a chained invocation
    • setFlatpak

      public final MMetadata.Builder setFlatpak(MMetadataFlatpakType flatpak)
      Initializes the value for the flatpak attribute.

      If not set, this attribute will have a default value as returned by the initializer of flatpak.

      Parameters:
      flatpak - The value for flatpak
      Returns:
      this builder for use in a chained invocation
    • build

      public MMetadata build()
      Builds a new MMetadata.
      Returns:
      An immutable instance of MMetadata
      Throws:
      IllegalStateException - if any required attributes are missing