/** * Sets the factories. This method is invoked by the {@link AllAuthoritiesFactory} subclass * only. No one else should invoke this method, since factories should be immutable. */ final synchronized void setFactories(final Collection<AuthorityFactory> factories) { this.factories = createFallbacks(factories); }
/** * Creates a new factory using the specified set of user factories. Any call to a {@code * createFoo(code)} method will scan the supplied factories in their iteration order. The first * factory implementing the appropriate interface and having the expected {@linkplain * AuthorityFactory#getAuthority authority name} will be used. * * <p>If the {@code factories} collection contains more than one factory for the same authority * and interface, then all additional factories will be {@linkplain FallbackAuthorityFactory * fallbacks}, to be tried in iteration order only if the first acceptable factory failed to * create the requested object. * * @param factories A set of user-specified factories to try before to delegate to {@link * GeometryFactoryFinder}. */ public ManyAuthoritiesFactory(final Collection<? extends AuthorityFactory> factories) { super(NORMAL_PRIORITY); inProgress = new ThreadLocal<Boolean>(); if (factories != null && !factories.isEmpty()) { for (final AuthorityFactory factory : factories) { if (factory instanceof Factory) { hints.putAll(((Factory) factory).getImplementationHints()); } } this.factories = createFallbacks(factories); } }