Package javax.xml.registry.infomodel

Examples of javax.xml.registry.infomodel.LocalizedString


        setValue(Locale.getDefault(), str);
    }

    public String getValue(Locale locale) throws JAXRException
    {
        LocalizedString localizedString = (LocalizedString) map.get(new MapKey(locale, LocalizedString.DEFAULT_CHARSET_NAME));
        return localizedString != null ? localizedString.getValue() : null;
    }
View Full Code Here


            Object obj = i.next();
            Name name = objectFactory.createName();
            if (obj instanceof String) {
                name.setValue((String)obj);
            } else if (obj instanceof LocalizedString) {
                LocalizedString ls = (LocalizedString)obj;
                name.setValue(ls.getValue());
                name.setLang(ls.getLocale().getLanguage());
            }
            result[currLoc] = name;
            currLoc++;
        }
        return result;
View Full Code Here

/**
* @version $Revision$ $Date$
*/
public class LocalizedStringTest extends TestCase {
    public void testEquals() {
        LocalizedString ls1 = new LocalizedStringImpl(Locale.US, "Equal", "UTF-8");
        LocalizedString ls2 = new LocalizedStringImpl(Locale.US, "Equal", "UTF-8");
        assertTrue(ls1.equals(ls2));
        assertTrue(ls2.equals(ls1));
        ls2 = new LocalizedStringImpl(Locale.US, "NotEqual", "UTF-8");
        assertFalse(ls1.equals(ls2));
        assertFalse(ls2.equals(ls1));
        ls2 = new LocalizedStringImpl(Locale.US, "Equal", "US-ASCII");
        assertFalse(ls1.equals(ls2));
        assertFalse(ls2.equals(ls1));
    }
View Full Code Here

        assertFalse(ls1.equals(ls2));
        assertFalse(ls2.equals(ls1));
    }

    public void testNullEquals() {
        LocalizedString ls1 = new LocalizedStringImpl(Locale.US, null, "UTF-8");
        LocalizedString ls2 = new LocalizedStringImpl(Locale.US, null, "UTF-8");
        assertTrue(ls1.equals(ls2));
        assertTrue(ls2.equals(ls1));
        ls2 = new LocalizedStringImpl(Locale.US, "NotEqual", "UTF-8");
        assertFalse(ls1.equals(ls2));
        assertFalse(ls2.equals(ls1));
        ls2 = new LocalizedStringImpl(Locale.US, null, "US-ASCII");
        assertFalse(ls1.equals(ls2));
        assertFalse(ls2.equals(ls1));
    }
View Full Code Here

        assertFalse(ls1.equals(ls2));
        assertFalse(ls2.equals(ls1));
    }

    public void testSetCharsetName() throws JAXRException {
        LocalizedString ls1 = new LocalizedStringImpl(Locale.US, "USA", "UTF-8");
        assertEquals("UTF-8", ls1.getCharsetName());
        ls1.setCharsetName("US-ASCII");
        assertEquals("US-ASCII", ls1.getCharsetName());
        try {
            ls1.setCharsetName(null);
            fail("expected IllegalArgumentException for null charsetName");
        } catch (IllegalArgumentException e) {
            // ok
        }
    }
View Full Code Here

            // ok
        }
    }

    public void testSetLocale() throws JAXRException {
        LocalizedString ls1 = new LocalizedStringImpl(Locale.US, "USA", "UTF-8");
        assertEquals(Locale.US, ls1.getLocale());
        ls1.setLocale(Locale.CANADA);
        assertEquals(Locale.CANADA, ls1.getLocale());
        try {
            ls1.setLocale(null);
            fail("expected IllegalArgumentException for null locale");
        } catch (IllegalArgumentException e) {
            // ok
        }
    }
View Full Code Here

            // ok
        }
    }

    public void testSetValue() throws JAXRException {
        LocalizedString ls1 = new LocalizedStringImpl(Locale.US, "USA", "UTF-8");
        assertEquals("USA", ls1.getValue());
        ls1.setValue("Foo");
        assertEquals("Foo", ls1.getValue());
        ls1.setValue(null);
        assertNull(ls1.getValue());
    }
View Full Code Here

            Object obj = i.next();
            Name n = Name.Factory.newInstance();
            if (obj instanceof String) {
                n.setStringValue((String)obj);
            } else if (obj instanceof LocalizedString) {
                LocalizedString ls = (LocalizedString)obj;
                n.setStringValue(ls.getValue());
                n.setLang(ls.getLocale().getLanguage());
            }
            result[currLoc] = n;
            currLoc++;
        }
        return result;
View Full Code Here

    public void addLocalizedStrings(Collection collection) throws JAXRException
    {
        for (Iterator i = collection.iterator(); i.hasNext();)
        {
            LocalizedString localizedString = (LocalizedString) i.next();
            map.put(new MapKey(localizedString), localizedString);
        }
    }
View Full Code Here

        setValue(Locale.getDefault(), str);
    }

    public String getValue(Locale locale) throws JAXRException
    {
        LocalizedString localizedString = (LocalizedString) map.get(new MapKey(locale, LocalizedString.DEFAULT_CHARSET_NAME));
        return localizedString != null ? localizedString.getValue() : null;
    }
View Full Code Here

TOP

Related Classes of javax.xml.registry.infomodel.LocalizedString

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.