/** * Returns the scope (name space) of this generic name. This method is protected from overriding * by the user. */ private GenericName getInternalScope() { if (asScopedName != null) { final NameSpace scope = asScopedName.scope(); if (scope != null) { return scope.name(); } } return null; }
/** * Returns the scope (name space) of this generic name. If this name has no scope (e.g. is the * root), then this method returns {@code null}. * * @deprecated Replaced by {@link #scope()}. */ public GenericName getScope() { return getName().scope().name(); }
/** * Produce a good key based on the privided citaiton and code. You can think of the citation as * being "here" and the code being the "what". * * @param code Code * @return A good key for use with ObjectCache */ public static String toKey(Citation citation, String code) { code = code.trim(); final GenericName name = NameFactory.create(code); final GenericName scope = name.scope().name(); if (scope == null) { return code; } if (citation != null && Citations.identifierMatches(citation, scope.toString())) { return name.tip().toString().trim(); } return code; }
/** * Trims the authority scope, if present. If more than one authority were given at {@linkplain * #PropertyAuthorityFactory(ReferencingFactoryContainer, Citation[], URL) construction time}, * then any of them may appears as the scope in the supplied code. * * @param code The code to trim. * @return The code without the authority scope. */ @Override protected String trimAuthority(String code) { code = code.trim(); final GenericName name = NameFactory.create(code); final GenericName scope = name.scope().name(); if (scope == null) { return code; } final String candidate = scope.toString(); for (int i = 0; i < authorities.length; i++) { if (Citations.identifierMatches(authorities[i], candidate)) { return name.tip().toString().trim(); } } return code; }
/** * Trims the authority scope, if present. For example if this factory is an EPSG authority * factory and the specified code start with the "EPSG:" prefix, then the prefix is removed. * Otherwise, the string is returned unchanged (except for leading and trailing spaces). * * @param code The code to trim. * @return The code without the authority scope. */ protected String trimAuthority(String code) { /* * IMPLEMENTATION NOTE: This method is overridden in * PropertyAuthorityFactory. If the implementation below is modified, it * is probably worth revisiting the overridden method as well. */ code = code.trim(); final GenericName name = NameFactory.create(code); final GenericName scope = name.scope().name(); if (scope == null) { return code; } if (Citations.identifierMatches(getAuthority(), scope.toString())) { return name.tip().toString().trim(); } return code; }
/** * Trims the authority scope, if present. For example if this factory is an EPSG authority * factory and the specified code start with the "EPSG:" prefix, then the prefix is removed. * Otherwise, the string is returned unchanged (except for leading and trailing spaces). * * @param code The code to trim. * @return The code without the authority scope. */ protected String trimAuthority(String code) { /* * IMPLEMENTATION NOTE: This method is overrided in PropertyAuthorityFactory. If * implementation below is modified, it is probably worth to revisit the overrided * method as well. */ code = code.trim(); final GenericName name = NameFactory.create(code); final GenericName scope = name.scope().name(); if (scope == null) { return code; } if (Citations.identifierMatches(getAuthority(), scope.toString())) { return name.tip().toString().trim(); } return code; }
final GenericName scope = alias.scope().name(); final GenericName name = alias.tip(); final Object title;
final GenericName scope = alias.scope().name(); if (scope != null) { if (title.equalsIgnoreCase(scope.toString())) {
/** * Returns the namespace of the names created by {@code setName(CharSequence...)} method calls. * A {@code null} value means that the names are in the * {@linkplain org.apache.sis.util.iso.DefaultNameSpace#isGlobal() global namespace}. * * @return the namespace to use when {@link #setName(CharSequence)} is invoked, or {@code null} if none. */ public CharSequence getNameSpace() { return (namespace != null) ? namespace.name().toString() : null; }
/** * Returns the schema name. * * @return the schema name. */ @Override public LocalName getSchemaName() { return namespace.name().tip(); }
/** * Returns the namespace of the names created by {@code setName(CharSequence...)} method calls. * A {@code null} value means that the names are in the * {@linkplain org.apache.sis.util.iso.DefaultNameSpace#isGlobal() global namespace}. * * @return the namespace to use when {@link #setName(CharSequence)} is invoked, or {@code null} if none. */ public CharSequence getNameSpace() { return (namespace != null) ? namespace.name().toString() : null; }
/** * Returns the schema name. * * @return the schema name. */ @Override public LocalName getSchemaName() { return namespace.name().tip(); }
/** * Returns the scope (name space) of this generic name. * This method is protected from overriding by the user. */ private GenericName getInternalScope() { if (asScopedName != null) { final NameSpace scope = asScopedName.scope(); if (scope != null) { return scope.name(); } } return null; }
final GenericName scope = alias.scope().name(); if (scope != null) { if (Citations.identifierMatches(authority, scope.toString())) {
/** * Null-safe getter for the namespace argument to be given to {@link #toClass(String, String)}. */ static String namespace(final NameSpace ns) { if (ns != null && !ns.isGlobal()) { final GenericName name = ns.name(); if (name != null) { return name.toString(); } } return null; }
/** * Null-safe getter for the namespace argument to be given to {@link #toClass(String, String)}. */ static String namespace(final NameSpace ns) { if (ns != null && !ns.isGlobal()) { final GenericName name = ns.name(); if (name != null) { return name.toString(); } } return null; }
assertEquals( "Authority", author, parameters.getName().getAuthority().getTitle().toString()); assertEquals("Vendor", vendor, alias.scope().name().toString()); assertNotNull("Version", parameters.getName().getVersion()); assertLocalized("Vendor", alias.scope().name().toInternationalString()); assertLocalized("Remarks", parameters.getRemarks()); assertTrue("Remarks", parameters.getRemarks().toString().trim().length() > 0);
/** * Sets the value from the given name. * * @param name the name to marshal. */ public final void setName(final GenericName name) { this.value = name.toString(); final NameSpace scope = name.scope(); if (scope != null && !scope.isGlobal()) { codeSpace = scope.name().toString(); } }
/** * Sets the value from the given name. * * @param name the name to marshal. */ public final void setName(final GenericName name) { this.value = name.toString(); final NameSpace scope = name.scope(); if (scope != null && !scope.isGlobal()) { codeSpace = scope.name().toString(); } }
/** * Tests navigation in a name parsed from a string. */ @Test public void testNavigation() { final GenericName name = factory.parseGenericName(null, "codespace:subspace:name"); assertEquals("codespace:subspace:name", name.toString()); assertEquals("codespace:subspace", name.tip().scope().name().toString()); assertEquals("codespace", name.tip().scope().name().tip().scope().name().toString()); assertSame(name, name.toFullyQualifiedName()); assertSame(name, name.tip().toFullyQualifiedName()); }