/** * Same as {@link #fromFactoryRegistry(String, Class)}, but returns every factories that fit the * given type. The factories are added to the specified set. */ final void fromFactoryRegistry( final String authority, final Class<? extends AuthorityFactory> type, final Set<AuthorityFactory> addTo) { for (int i = 0; i < OBJECT_TYPES.length; i++) { if (OBJECT_TYPES[i].isAssignableFrom(type)) { final AuthorityFactory factory; try { factory = fromFactoryRegistry(authority, FACTORY_TYPES[i]); } catch (FactoryRegistryException e) { // No factory for the given authority. It may be normal. continue; } if (!exclude(factory)) { addTo.add(factory); } } } }
/** Returns a factory for the specified authority and type. */ @Override final <T extends AuthorityFactory> T fromFactoryRegistry( final String authority, final Class<T> type) throws FactoryRegistryException { final AuthorityFactory f; if (CRSAuthorityFactory.class.equals(type)) { f = ReferencingFactoryFinder.getCRSAuthorityFactory(authority, getHints()); } else if (CSAuthorityFactory.class.equals(type)) { f = ReferencingFactoryFinder.getCSAuthorityFactory(authority, getHints()); } else if (DatumAuthorityFactory.class.equals(type)) { f = ReferencingFactoryFinder.getDatumAuthorityFactory(authority, getHints()); } else if (CoordinateOperationAuthorityFactory.class.equals(type)) { f = ReferencingFactoryFinder.getCoordinateOperationAuthorityFactory( authority, getHints()); } else { f = super.fromFactoryRegistry(authority, type); } return type.cast(f); }
/** Returns all factories to try. */ private Set<AuthorityFactory> fromFactoryRegistry() { final ManyAuthoritiesFactory factory = (ManyAuthoritiesFactory) getProxy().getAuthorityFactory(); final Class<? extends AuthorityFactory> type = getProxy().getType(); final Set<AuthorityFactory> factories = new LinkedHashSet<AuthorityFactory>(); for (final String authority : ReferencingFactoryFinder.getAuthorityNames()) { factory.fromFactoryRegistry(authority, type, factories); } // Removes the factories already tried by super-class. final Collection<AuthorityFactory> done = getFactories(); if (done != null) { factories.removeAll(done); } return factories; }
factory = fromFactoryRegistry(authority, type); } catch (FactoryRegistryException exception) { cause = exception;