Package org.opengis.util

Examples of org.opengis.util.NameFactory


     *
     * @throws JAXBException Should not happen.
     */
    @Test
    public void testLocalName() throws JAXBException {
        final NameFactory factory = DefaultFactories.NAMES;
        final LocalName name = factory.createLocalName(null, "An ordinary local name");
        assertEquals("An ordinary local name", name.toString());
        final String expected =
                "<gml:IO_IdentifiedObject>\n" +
                "  <gml:alias>\n" +
                "    <gco:LocalName>An ordinary local name</gco:LocalName>\n" +
View Full Code Here


     * @throws JAXBException Should not happen.
     */
    @Test
    @DependsOnMethod("testLocalName")
    public void testLocalNameWithAmp() throws JAXBException {
        final NameFactory factory = DefaultFactories.NAMES;
        final LocalName name = factory.createLocalName(null, "A name with & and > and <.");
        assertEquals("A name with & and > and <.", name.toString());
        final String expected =
                "<gml:IO_IdentifiedObject>\n" +
                "  <gml:alias>\n" +
                "    <gco:LocalName>A name with &amp; and &gt; and &lt;.</gco:LocalName>\n" +
View Full Code Here

     *
     * @throws JAXBException Should not happen.
     */
    @Test
    public void testTypeName() throws JAXBException {
        final NameFactory factory = DefaultFactories.NAMES;
        final TypeName name = factory.createTypeName(null, "An other local name");
        assertEquals("An other local name", name.toString());
        final String expected =
                "<gml:IO_IdentifiedObject>\n" +
                "  <gml:alias>\n" +
                "    <gco:TypeName>\n" +
View Full Code Here

     *
     * @throws JAXBException Should not happen.
     */
    @Test
    public void testScopedName() throws JAXBException {
        final NameFactory factory = DefaultFactories.NAMES;
        final GenericName name = factory.createGenericName(null, "myScope","myName");
        assertEquals("myScope:myName", name.toString());
        final String expected =
                "<gml:IO_IdentifiedObject>\n" +
                "  <gml:alias>\n" +
                "    <gco:ScopedName>myScope:myName</gco:ScopedName>\n" +
View Full Code Here

     * @param  code The code.
     * @return A new generic name for the given authority and code.
     * @category Generic name
     */
    private GenericName createName(final Citation authority, final CharSequence code) {
        final NameFactory factory = DefaultFactories.NAMES;
        final String title = Citations.getIdentifier(authority); // Whitespaces trimed by Citations.
        NameSpace scope = null;
        if (title != null) {
            synchronized (SCOPES) {
                scope = SCOPES.get(title);
                if (scope == null) {
                    scope = factory.createNameSpace(factory.createLocalName(null, title), null);
                    SCOPES.put(title, scope);
                }
            }
        }
        final String codeSpace = super.getCodeSpace();
        if (codeSpace != null) {
            return factory.createGenericName(scope, codeSpace, code);
        } else {
            return factory.createLocalName(scope, code);
        }
    }
View Full Code Here

     *
     * @throws JAXBException Should not happen.
     */
    @Test
    public void testLocalName() throws JAXBException {
        final NameFactory factory = DefaultFactories.NAMES;
        final LocalName name = factory.createLocalName(null, "An ordinary local name");
        assertEquals("An ordinary local name", name.toString());
        final String expected =
                "<gml:IO_IdentifiedObject xmlns:gml=\"" + Namespaces.GML + '"' +
                                        " xmlns:gco=\"" + Namespaces.GCO + "\">\n" +
                "  <gml:alias>\n" +
View Full Code Here

     * @throws JAXBException Should not happen.
     */
    @Test
    @DependsOnMethod("testLocalName")
    public void testLocalNameWithAmp() throws JAXBException {
        final NameFactory factory = DefaultFactories.NAMES;
        final LocalName name = factory.createLocalName(null, "A name with & and > and <.");
        assertEquals("A name with & and > and <.", name.toString());
        final String expected =
                "<gml:IO_IdentifiedObject xmlns:gml=\"" + Namespaces.GML + '"' +
                                        " xmlns:gco=\"" + Namespaces.GCO + "\">\n" +
                "  <gml:alias>\n" +
View Full Code Here

     *
     * @throws JAXBException Should not happen.
     */
    @Test
    public void testTypeName() throws JAXBException {
        final NameFactory factory = DefaultFactories.NAMES;
        final TypeName name = factory.createTypeName(null, "An other local name");
        assertEquals("An other local name", name.toString());
        final String expected =
                "<gml:IO_IdentifiedObject xmlns:gml=\"" + Namespaces.GML + '"' +
                                        " xmlns:gco=\"" + Namespaces.GCO + "\">\n" +
                "  <gml:alias>\n" +
View Full Code Here

     *
     * @throws JAXBException Should not happen.
     */
    @Test
    public void testScopedName() throws JAXBException {
        final NameFactory factory = DefaultFactories.NAMES;
        final GenericName name = factory.createGenericName(null, "myScope","myName");
        assertEquals("myScope:myName", name.toString());
        final String expected =
                "<gml:IO_IdentifiedObject xmlns:gml=\"" + Namespaces.GML + '"' +
                                        " xmlns:gco=\"" + Namespaces.GCO + "\">\n" +
                "  <gml:alias>\n" +
View Full Code Here

TOP

Related Classes of org.opengis.util.NameFactory

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.