Class InternationalStringImpl
- java.lang.Object
-
- com.sun.xml.registry.uddi.infomodel.InternationalStringImpl
-
- All Implemented Interfaces:
Serializable,InternationalString
public class InternationalStringImpl extends Object implements InternationalString, Serializable
Implementation of JAXR InternationalString. "default locale" in comments below refers to the locale given by Locale.getDefault() at runtime. Class contains a java.util.HashMap that maps locales to LocalizedString instances. Unless specified for a given method, the behavior for null locales and values is the same as for null keys and objects in HashMap.- Author:
- Bobby Bissett
- See Also:
- Serialized Form
-
-
Constructor Summary
Constructors Constructor Description InternationalStringImpl()Default constructor creates empty hash map for holding LocalizedStrings.InternationalStringImpl(String value)Utility constructor used to set a string value for the default locale.InternationalStringImpl(Locale locale, String value)Utility constructor used with given locale and string.InternationalStringImpl(LocalizedString lString)Utility constructor used with a given LocalizedString.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description voidaddLocalizedString(LocalizedString localizedString)Adds given localized string to collection.voidaddLocalizedStrings(Collection strings)Adds localized strings to the collection.LocalizedStringgetLocalizedString(Locale locale, String charsetName)Gets the localized string for the given locale, if one exists.CollectiongetLocalizedStrings()Get the localized strings contained in this international string.StringgetValue()Returns the string value for default localeStringgetValue(Locale locale)Returns the string value for the given locale.voidremoveLocalizedString(LocalizedString lString)Removes given localized string.voidremoveLocalizedStrings(Collection lStrings)Removes localized strings from the international string if they are present.voidsetValue(String string)Sets string value for default localevoidsetValue(Locale locale, String string)Sets the string value for the specified locale
-
-
-
Constructor Detail
-
InternationalStringImpl
public InternationalStringImpl()
Default constructor creates empty hash map for holding LocalizedStrings.
-
InternationalStringImpl
public InternationalStringImpl(LocalizedString lString) throws JAXRException
Utility constructor used with a given LocalizedString.- Parameters:
string- LocalizedString to store- Throws:
JAXRException
-
InternationalStringImpl
public InternationalStringImpl(Locale locale, String value)
Utility constructor used with given locale and string.- Parameters:
locale-value- String value for given locale
-
InternationalStringImpl
public InternationalStringImpl(String value)
Utility constructor used to set a string value for the default locale.- Parameters:
value- Store this value for the default locale
-
-
Method Detail
-
getValue
public String getValue() throws JAXRException
Returns the string value for default locale- Specified by:
getValuein interfaceInternationalString- Returns:
- the String value for the Locale returned by Locale.getDefault()
- Throws:
JAXRException- If the JAXR provider encounters an internal error
-
getValue
public String getValue(Locale locale) throws JAXRException
Returns the string value for the given locale. If locale is null or there is no localized string for the given locale, the method will return null.- Specified by:
getValuein interfaceInternationalString- Parameters:
locale- The Locale for the desired value- Returns:
- the String value for the specified Locale
- Throws:
JAXRException- If the JAXR provider encounters an internal error
-
setValue
public void setValue(String string) throws JAXRException
Sets string value for default locale- Specified by:
setValuein interfaceInternationalString- Parameters:
string- the String value for the Locale returned by Locale.getDefault()- Throws:
JAXRException- If the JAXR provider encounters an internal error
-
setValue
public void setValue(Locale locale, String string) throws JAXRException
Sets the string value for the specified locale- Specified by:
setValuein interfaceInternationalString- Parameters:
locale- The locale for this value being setstring- The value being set- Throws:
JAXRException- If the JAXR provider encounters an internal error
-
addLocalizedString
public void addLocalizedString(LocalizedString localizedString) throws JAXRException
Adds given localized string to collection. LocalizedString parameter cannot be null.- Specified by:
addLocalizedStringin interfaceInternationalString- Parameters:
localizedString- the LocalizedString being added to this object- Throws:
JAXRException- If the JAXR provider encounters an internal error
-
addLocalizedStrings
public void addLocalizedStrings(Collection strings) throws JAXRException
Adds localized strings to the collection. If there are multiple localized strings for the same locale, it is unspecified which one will be set for this international string.- Specified by:
addLocalizedStringsin interfaceInternationalString- Parameters:
strings- the Collection of LocalizedStrings being added to this object- Throws:
JAXRException- If the JAXR provider encounters an internal error
-
removeLocalizedString
public void removeLocalizedString(LocalizedString lString) throws JAXRException
Removes given localized string. If the localized string is not in this international string, nothing happens. Parameter localized string cannot be null.- Specified by:
removeLocalizedStringin interfaceInternationalString- Parameters:
lString- the LocalizedString being removed from this object- Throws:
JAXRException- If the JAXR provider encounters an internal error
-
removeLocalizedStrings
public void removeLocalizedStrings(Collection lStrings) throws JAXRException
Removes localized strings from the international string if they are present.- Specified by:
removeLocalizedStringsin interfaceInternationalString- Parameters:
lStrings- the Collection of LocalizedStrings being removed from this object- Throws:
JAXRException- If the JAXR provider encounters an internal error
-
getLocalizedString
public LocalizedString getLocalizedString(Locale locale, String charsetName) throws JAXRException
Gets the localized string for the given locale, if one exists.- Specified by:
getLocalizedStringin interfaceInternationalString- Parameters:
locale- The loacle for the desired LocalizedStringscharsetName- The character set name for the desired LocalizedStrings- Returns:
- the LocalizedString that matches specified locale and character set
- Throws:
JAXRException- If the JAXR provider encounters an internal error
-
getLocalizedStrings
public Collection getLocalizedStrings() throws JAXRException
Get the localized strings contained in this international string. This method creates a new collection to return rather than the one that backs the hash map.- Specified by:
getLocalizedStringsin interfaceInternationalString- Returns:
- Collection of LocalizedString instances. The Collection may be empty but not null.
- Throws:
JAXRException- If the JAXR provider encounters an internal error- See Also:
LocalizedString
-
-