/** Returns {@code true} if the specified identifiers contains the {@code "EPSG"} code. */ static boolean containsEPSG(final Object identifiers) { assertTrue(identifiers instanceof Collection); @SuppressWarnings("unchecked") final Collection<Identifier> collection = (Collection) identifiers; for (final Identifier id : collection) { if (id.getCode().equals("EPSG")) { return true; } } return false; }
/** Returns the names of all currently registered authorities. */ public static synchronized Set<String> getAuthorityNames() { /* * IMPORTANT: Return the same Set instance (unmodifiable) as long as there is no change * in the list of registered factories, and create a new instance in case of changes. * 'add/removeAuthorityFactory(...)' and 'scanForPlugins()' methods reset 'authorityNames' * to null, which will cause the creation of a new Set instance. Some implementations like * AllAuthoritiesFactory rely on this behavior as a way to be notified of registration * changes for clearing their cache. */ if (authorityNames == null) { authorityNames = new LinkedHashSet<String>(); final Hints hints = EMPTY_HINTS; loop: for (int i = 0; ; i++) { final Set<? extends AuthorityFactory> factories; switch (i) { case 0: factories = getCRSAuthorityFactories(hints); break; case 1: factories = getCSAuthorityFactories(hints); break; case 2: factories = getDatumAuthorityFactories(hints); break; case 3: factories = getCoordinateOperationAuthorityFactories(hints); break; default: break loop; } for (final AuthorityFactory factory : factories) { final Citation authority = factory.getAuthority(); if (authority != null) { authorityNames.add(Citations.getIdentifier(authority)); for (final Identifier id : authority.getIdentifiers()) { authorityNames.add(id.getCode()); } } } } authorityNames = Collections.unmodifiableSet(authorityNames); } return authorityNames; }