public static final class LocalizedText.Builder extends Object
LocalizedText. This class is not thread-safe.| Constructor and Description |
|---|
Builder() |
| Modifier and Type | Method and Description |
|---|---|
LocalizedText |
build()
Builds a
LocalizedText based on the current getTexts() data. |
Map<String,String> |
getTexts()
Returns a view to the current texts.
|
LocalizedText.Builder |
removeAll()
Removes all texts.
|
LocalizedText.Builder |
removeText(Locale locale)
Removes text for given locale.
|
LocalizedText.Builder |
removeText(String localeId)
Removes text for given locale.
|
LocalizedText.Builder |
setDefaultText(String text)
Sets the text for the default locale.
|
LocalizedText.Builder |
setText(String text,
Locale locale)
Sets the text for the given locale.
|
LocalizedText.Builder |
setText(String text,
String localeId)
Sets the text for the given locale.
|
LocalizedText.Builder |
setTexts(LocalizedText localizedText)
Sets all texts from the given
LocalizedText to this LocalizedText.Builder. |
public LocalizedText build()
LocalizedText based on the current getTexts() data. Throws
IllegalStateException if somehow a null locale or null text (use empty String
instead) has been set (e.g. by modifying getTexts() output directly). If no texts
are set, returns LocalizedText.EMPTY.public Map<String,String> getTexts()
Map keys are the LocaleIds and the values
texts in that locale. An empty key is used for the default locale (i.e. "invariant locale").
Modifications to the returned map modifies this Builder. Note that null keys and values are
not permitted. OPC UA LocalizedText considers null and empty to be the same and they are
binary-encoded as "not present", here empty String is used to indicate "not present". If a
null key or value has been set to the map, the build() will throw an
IllegalStateException.
public LocalizedText.Builder removeAll()
public LocalizedText.Builder removeText(Locale locale)
public LocalizedText.Builder removeText(String localeId)
public LocalizedText.Builder setDefaultText(String text)
setText(String, String) with empty localeId.public LocalizedText.Builder setText(String text, Locale locale)
public LocalizedText.Builder setText(String text, String localeId)
public LocalizedText.Builder setTexts(LocalizedText localizedText)
LocalizedText to this LocalizedText.Builder. This behaves the
same as calling Map.putAll(Map) for getTexts() using the
LocalizedText.getTexts() from the given LocalizedText. A given null value
behaves the same as-if LocalizedText.EMPTY would have been given.Copyright © 2026. All rights reserved.