/** * Returns the scope (name space) in which this name is local. * * @since 2.3 */ public NameSpace scope() { return getName().scope(); }
/** * 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;
/** * Returns the separator to write before the given name. If the scope of the given name * is a {@link DefaultNameSpace} instance, then this method returns its head separator. * We really want {@link DefaultNameSpace#headSeparator}, not {@link DefaultNameSpace#separator}. * See {@link DefaultNameSpace#child(CharSequence, String)} for details. * * @param name the name after which to write a separator. * @return the separator to write after the given name. */ static String separator(final GenericName name) { if (name != null) { final NameSpace scope = name.scope(); if (scope instanceof DefaultNameSpace) { return ((DefaultNameSpace) scope).headSeparator; } } return DefaultNameSpace.DEFAULT_SEPARATOR_STRING; }
/** * Returns the separator to write before the given name. If the scope of the given name is * a {@link DefaultNameSpace} instance, then this method returns its head separator. We really * want {@link DefaultNameSpace#headSeparator}, not {@link DefaultNameSpace#separator}. See * {@link DefaultNameSpace#child(CharSequence)} for details. * * @param The name after which to write a separator. * @return The separator to write after the given name. */ static String separator(final GenericName name) { if (name != null) { final NameSpace scope = name.scope(); if (scope instanceof DefaultNameSpace) { return ((DefaultNameSpace) scope).headSeparator; } } return DefaultNameSpace.DEFAULT_SEPARATOR_STRING; }
final GenericName scope = alias.scope().name(); if (scope != null) { if (title.equalsIgnoreCase(scope.toString())) {
/** * Returns the scope (name space) in which this name is local. * By default, this is the same value than the {@link #getAuthority() authority} provided as a name space. * * @see #head() * @see #getAuthority() * * @return the scope of this name. */ @Override public NameSpace scope() { return getName().scope(); }
/** * Returns the scope (name space) in which this name is local. * By default, this is the same value than the {@link #getAuthority() authority} provided as a name space. * * @see #head() * @see #getAuthority() * * @return the scope of this name. */ @Override public NameSpace scope() { return getName().scope(); }
final GenericName scope = alias.scope().name(); if (scope != null) { if (Citations.identifierMatches(authority, scope.toString())) {
/** * Returns the scope of the given name if it is not global. * This method is null-safe, including paranoiac checks against null scope. * * @param name the name from which to get the scope, or {@code null}. * @return the scope of the given name, or {@code null} if the given name was null or has a global scope. */ private static GenericName scope(final GenericName name) { if (name != null) { final NameSpace scope = name.scope(); if (scope != null && !scope.isGlobal()) { return scope.name(); } } return null; }
/** * Returns the scope of the given name if it is not global. * This method is null-safe, including paranoiac checks against null scope. * * @param name the name from which to get the scope, or {@code null}. * @return the scope of the given name, or {@code null} if the given name was null or has a global scope. */ private static GenericName scope(final GenericName name) { if (name != null) { final NameSpace scope = name.scope(); if (scope != null && !scope.isGlobal()) { return scope.name(); } } return null; }
/** * 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; }
/** * Recreates a new name for the given name, using the given factory. * This is used in order to get a Geotk implementation from an * arbitrary implementation. */ static GenericName wrap(final GenericName value, final NameFactory factory) { final List<? extends LocalName> parsedNames = value.getParsedNames(); final CharSequence[] names = new CharSequence[parsedNames.size()]; int i=0; for (final LocalName name : parsedNames) { // Asks for the unlocalized name, since we are going to marshal that. names[i++] = name.toInternationalString().toString(null); } if (i != names.length) { throw new ConcurrentModificationException(); } return factory.createGenericName(value.scope(), names); }
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(); } }