Class MTranslatedText.Builder
java.lang.Object
com.io7m.montarre.api.MTranslatedText.Builder
- Enclosing class:
MTranslatedText
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 TypeMethodDescriptionbuild()Builds a newMTranslatedText.final MTranslatedText.Builderfrom(MTranslatedTextType instance) Fill a builder with attribute values from the providedMTranslatedTextTypeinstance.final MTranslatedText.BuilderputAllTranslations(Map<? extends MLanguageCode, ? extends String> entries) Put all mappings from the specified map as entries totranslationsmap.final MTranslatedText.BuilderputTranslations(MLanguageCode key, String value) Put one entry to thetranslationsmap.final MTranslatedText.BuilderputTranslations(Map.Entry<? extends MLanguageCode, ? extends String> entry) Put one entry to thetranslationsmap.final MTranslatedText.BuildersetLanguage(MLanguageCode language) Initializes the value for thelanguageattribute.final MTranslatedText.BuilderInitializes the value for thetextattribute.final MTranslatedText.BuildersetTranslations(Map<? extends MLanguageCode, ? extends String> entries) Sets or replaces all mappings from the specified map as entries for thetranslationsmap.
-
Method Details
-
from
Fill a builder with attribute values from the providedMTranslatedTextTypeinstance. 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:
thisbuilder for use in a chained invocation
-
setLanguage
-
setText
Initializes the value for thetextattribute.- Parameters:
text- The value for text- Returns:
thisbuilder for use in a chained invocation
-
putTranslations
Put one entry to thetranslationsmap.- Parameters:
key- The key in the translations mapvalue- The associated value in the translations map- Returns:
thisbuilder for use in a chained invocation
-
putTranslations
public final MTranslatedText.Builder putTranslations(Map.Entry<? extends MLanguageCode, ? extends String> entry) Put one entry to thetranslationsmap. Nulls are not permitted- Parameters:
entry- The key and value entry- Returns:
thisbuilder 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 thetranslationsmap. Nulls are not permitted- Parameters:
entries- The entries that will be added to the translations map- Returns:
thisbuilder 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 totranslationsmap. Nulls are not permitted- Parameters:
entries- The entries that will be added to the translations map- Returns:
thisbuilder for use in a chained invocation
-
build
Builds a newMTranslatedText.- Returns:
- An immutable instance of MTranslatedText
- Throws:
IllegalStateException- if any required attributes are missing
-