com.prosysopc.ua
Class LocalizedTextMap

java.lang.Object
  extended by com.prosysopc.ua.LocalizedTextMap

public class LocalizedTextMap
extends Object

A collection of LocalizedTexts. The class is used to hold available LocalizedText values in different locales. You can add a new text with any Locale into the map, and retrieve an entry with any Locale. If the specific Locale has no text defined, the DefaultLocale is used.


Constructor Summary
LocalizedTextMap()
          Create new empty LocalizedTextMap.
LocalizedTextMap(org.opcfoundation.ua.builtintypes.LocalizedText defaultText)
          Create a new LocalizedTextMap with the defined text as default.
LocalizedTextMap(String defaultText, Locale defaultLocale)
          Create a new LocalizedTextMap with the defined text as default.
 
Method Summary
static LocalizedTextMap[] createMany(org.opcfoundation.ua.builtintypes.LocalizedText[] defaultTexts)
          Create an array of LocalizedTextMaps.
static org.opcfoundation.ua.builtintypes.LocalizedText[] getArrayValues(LocalizedTextMap[] array, Locale locale)
          Create an array of LocalizedText by calling getLocalizedText(Locale) for each LocalizedTextMap given as parameter with the given locale.
 Locale getDefaultLocale()
          Returns the locale that is used for texts that do not have locale-specific text set.
 org.opcfoundation.ua.builtintypes.LocalizedText getLocalizedText(Locale locale)
          Get LocalizedText for the defined locale.
 org.opcfoundation.ua.builtintypes.LocalizedText getLocalizedText(String localeId)
          Get LocalizedText for the given localeId.
 String getText(Locale locale)
          Get text for the defined locale.
 boolean hasText(Locale locale)
          Check if the map contains a localized text for the defined locale.
 void setLocalizedText(org.opcfoundation.ua.builtintypes.LocalizedText localizedText)
          Set the text for a specific locale, as defined by a LocalizedText The method calls setText using the locale and text from the localizedText.
 void setText(String text, Locale locale)
          Define the text for a specific locale
 String toString()
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

LocalizedTextMap

public LocalizedTextMap()
Create new empty LocalizedTextMap.


LocalizedTextMap

public LocalizedTextMap(org.opcfoundation.ua.builtintypes.LocalizedText defaultText)
Create a new LocalizedTextMap with the defined text as default.

Parameters:
defaultText - the default localized text. If null, LocalizedText.NULL is used.

LocalizedTextMap

public LocalizedTextMap(String defaultText,
                        Locale defaultLocale)
Create a new LocalizedTextMap with the defined text as default.

Parameters:
defaultText - the default localized text
defaultLocale - the default locale to use.
Method Detail

createMany

public static LocalizedTextMap[] createMany(org.opcfoundation.ua.builtintypes.LocalizedText[] defaultTexts)
Create an array of LocalizedTextMaps. Returned array is equal length and each has the corresponding index as entry.


getArrayValues

public static org.opcfoundation.ua.builtintypes.LocalizedText[] getArrayValues(LocalizedTextMap[] array,
                                                                               Locale locale)
Create an array of LocalizedText by calling getLocalizedText(Locale) for each LocalizedTextMap given as parameter with the given locale.


getDefaultLocale

public Locale getDefaultLocale()
Returns the locale that is used for texts that do not have locale-specific text set. Returns null if there is no entry or if the invariant locale text has been set.


getLocalizedText

public org.opcfoundation.ua.builtintypes.LocalizedText getLocalizedText(Locale locale)
Get LocalizedText for the defined locale.

Parameters:
locale - the desired locale. If null, the defaultLocale is used
Returns:
the text for the locale or the defaultText, if the defined locale has no specified text defined

getLocalizedText

public org.opcfoundation.ua.builtintypes.LocalizedText getLocalizedText(String localeId)
Get LocalizedText for the given localeId.

Parameters:
localeId - the localeId
Returns:
localizedText for the given locale, if not found then the default text, or LocalizedText.NULL if default is not defined.

getText

public String getText(Locale locale)
Get text for the defined locale.

Parameters:
locale - the desired locale
Returns:
the text for the locale or the defaultText, if the defined locale has no specifid text defined

hasText

public boolean hasText(Locale locale)
Check if the map contains a localized text for the defined locale.

Parameters:
locale - the locale to check
Returns:
true, if the map contains a specific definition for the locale.

setLocalizedText

public void setLocalizedText(org.opcfoundation.ua.builtintypes.LocalizedText localizedText)
Set the text for a specific locale, as defined by a LocalizedText The method calls setText using the locale and text from the localizedText.

Parameters:
localizedText - the localized text to add to the map. If null, LocalizedText.NULL is used.

setText

public void setText(String text,
                    Locale locale)
Define the text for a specific locale

Parameters:
text - the text for the locale
locale - the locale to define. Use null to define the text for the defaultLocale

toString

public String toString()
Overrides:
toString in class Object


Copyright © 2018. All rights reserved.