Class MNames.Builder

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

public static final class MNames.Builder extends Object
Builds instances of type MNames. 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 MNames.Builder from(MNamesType instance)
      Fill a builder with attribute values from the provided MNamesType instance. Regular attribute values will be replaced with those from the given instance. Absent optional values will not replace present values.
      Parameters:
      instance - The instance from which to copy values
      Returns:
      this builder for use in a chained invocation
    • setPackageName

      public final MNames.Builder setPackageName(MPackageName packageName)
      Initializes the value for the packageName attribute.
      Parameters:
      packageName - The value for packageName
      Returns:
      this builder for use in a chained invocation
    • setHumanName

      public final MNames.Builder setHumanName(String humanName)
      Initializes the value for the humanName attribute.

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

      Parameters:
      humanName - The value for humanName
      Returns:
      this builder for use in a chained invocation
    • setShortName

      public final MNames.Builder setShortName(MShortName shortName)
      Initializes the value for the shortName attribute.
      Parameters:
      shortName - The value for shortName
      Returns:
      this builder for use in a chained invocation
    • build

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