Class InternationalStringImpl

  • All Implemented Interfaces:
    Serializable, javax.xml.registry.infomodel.InternationalString

    public class InternationalStringImpl
    extends Object
    implements javax.xml.registry.infomodel.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 Detail

      • InternationalStringImpl

        public InternationalStringImpl()
        Default constructor creates empty hash map for holding LocalizedStrings.
      • InternationalStringImpl

        public InternationalStringImpl​(javax.xml.registry.infomodel.LocalizedString lString)
                                throws javax.xml.registry.JAXRException
        Utility constructor used with a given LocalizedString.
        Parameters:
        string - LocalizedString to store
        Throws:
        javax.xml.registry.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 javax.xml.registry.JAXRException
        Returns the string value for default locale
        Specified by:
        getValue in interface javax.xml.registry.infomodel.InternationalString
        Throws:
        javax.xml.registry.JAXRException
      • getValue

        public String getValue​(Locale locale)
                        throws javax.xml.registry.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:
        getValue in interface javax.xml.registry.infomodel.InternationalString
        Throws:
        javax.xml.registry.JAXRException
      • setValue

        public void setValue​(String string)
                      throws javax.xml.registry.JAXRException
        Sets string value for default locale
        Specified by:
        setValue in interface javax.xml.registry.infomodel.InternationalString
        Throws:
        javax.xml.registry.JAXRException
      • setValue

        public void setValue​(Locale locale,
                             String string)
                      throws javax.xml.registry.JAXRException
        Sets the string value for the specified locale
        Specified by:
        setValue in interface javax.xml.registry.infomodel.InternationalString
        Throws:
        javax.xml.registry.JAXRException
      • addLocalizedString

        public void addLocalizedString​(javax.xml.registry.infomodel.LocalizedString localizedString)
                                throws javax.xml.registry.JAXRException
        Adds given localized string to collection. LocalizedString parameter cannot be null.
        Specified by:
        addLocalizedString in interface javax.xml.registry.infomodel.InternationalString
        Throws:
        javax.xml.registry.JAXRException
      • addLocalizedStrings

        public void addLocalizedStrings​(Collection strings)
                                 throws javax.xml.registry.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:
        addLocalizedStrings in interface javax.xml.registry.infomodel.InternationalString
        Throws:
        javax.xml.registry.JAXRException
      • removeLocalizedString

        public void removeLocalizedString​(javax.xml.registry.infomodel.LocalizedString lString)
                                   throws javax.xml.registry.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:
        removeLocalizedString in interface javax.xml.registry.infomodel.InternationalString
        Throws:
        javax.xml.registry.JAXRException
      • removeLocalizedStrings

        public void removeLocalizedStrings​(Collection lStrings)
                                    throws javax.xml.registry.JAXRException
        Removes localized strings from the international string if they are present.
        Specified by:
        removeLocalizedStrings in interface javax.xml.registry.infomodel.InternationalString
        Throws:
        javax.xml.registry.JAXRException
      • getLocalizedString

        public javax.xml.registry.infomodel.LocalizedString getLocalizedString​(Locale locale,
                                                                               String charsetName)
                                                                        throws javax.xml.registry.JAXRException
        Gets the localized string for the given locale, if one exists.
        Specified by:
        getLocalizedString in interface javax.xml.registry.infomodel.InternationalString
        Throws:
        javax.xml.registry.JAXRException
      • getLocalizedStrings

        public Collection getLocalizedStrings()
                                       throws javax.xml.registry.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:
        getLocalizedStrings in interface javax.xml.registry.infomodel.InternationalString
        Throws:
        javax.xml.registry.JAXRException