Package com.io7m.montarre.api

# Class MTranslatedText.Builder

java.lang.Object
com.io7m.montarre.api.MTranslatedText.Builder

Enclosing class:
  `MTranslatedText`

public static final class MTranslatedText.Builder extends Object
Builds instances of type `MTranslatedText`. 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 Summary

  Modifier and Type
  Method
  Description
  `MTranslatedText`
  `build()`
  Builds a new `MTranslatedText`.
  `final MTranslatedText.Builder`
  `from(MTranslatedTextType instance)`
  Fill a builder with attribute values from the provided `MTranslatedTextType` instance.
  `final MTranslatedText.Builder`
  `putAllTranslations(Map<? extends MLanguageCode,? extends String> entries)`
  Put all mappings from the specified map as entries to `translations` map.
  `final MTranslatedText.Builder`
  `putTranslations(MLanguageCode key, String value)`
  Put one entry to the `translations` map.
  `final MTranslatedText.Builder`
  `putTranslations(Map.Entry<? extends MLanguageCode,? extends String> entry)`
  Put one entry to the `translations` map.
  `final MTranslatedText.Builder`
  `setLanguage(MLanguageCode language)`
  Initializes the value for the `language` attribute.
  `final MTranslatedText.Builder`
  `setText(String text)`
  Initializes the value for the `text` attribute.
  `final MTranslatedText.Builder`
  `setTranslations(Map<? extends MLanguageCode,? extends String> entries)`
  Sets or replaces all mappings from the specified map as entries for the `translations` map.

  ### Methods inherited from class java.lang.Object

  `clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

- ## Method Details

  - ### from

    public final MTranslatedText.Builder from(MTranslatedTextType instance)
    Fill a builder with attribute values from the provided `MTranslatedTextType` 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

  - ### setLanguage

    public final MTranslatedText.Builder setLanguage(MLanguageCode language)
    Initializes the value for the `language` attribute.

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

    Parameters:
      `language` - The value for language
    Returns:
      `this` builder for use in a chained invocation

  - ### setText

    public final MTranslatedText.Builder setText(String text)
    Initializes the value for the `text` attribute.
    Parameters:
      `text` - The value for text
    Returns:
      `this` builder for use in a chained invocation

  - ### putTranslations

    public final MTranslatedText.Builder putTranslations(MLanguageCode key, String value)
    Put one entry to the `translations` map.
    Parameters:
      `key` - The key in the translations map
      `value` - The associated value in the translations map
    Returns:
      `this` builder for use in a chained invocation

  - ### putTranslations

    public final MTranslatedText.Builder putTranslations(Map.Entry<? extends MLanguageCode,? extends String> entry)
    Put one entry to the `translations` map. Nulls are not permitted
    Parameters:
      `entry` - The key and value entry
    Returns:
      `this` builder for use in a chained invocation

  - ### setTranslations

    public final MTranslatedText.Builder setTranslations(Map<? extends MLanguageCode,? extends String> entries)
    Sets or replaces all mappings from the specified map as entries for the `translations` map. Nulls are not permitted
    Parameters:
      `entries` - The entries that will be added to the translations map
    Returns:
      `this` builder for use in a chained invocation

  - ### putAllTranslations

    public final MTranslatedText.Builder putAllTranslations(Map<? extends MLanguageCode,? extends String> entries)
    Put all mappings from the specified map as entries to `translations` map. Nulls are not permitted
    Parameters:
      `entries` - The entries that will be added to the translations map
    Returns:
      `this` builder for use in a chained invocation

  - ### build

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