Package org.apache.sis.referencing
Class AuthorityFactories<T extends org.opengis.referencing.AuthorityFactory>
java.lang.Object
java.util.AbstractCollection<E>
java.util.AbstractSet<E>
org.apache.sis.internal.util.SetOfUnknownSize<E>
org.apache.sis.internal.referencing.LazySet<T>
org.apache.sis.referencing.AuthorityFactories<T>
- All Implemented Interfaces:
Iterable<T>,Collection<T>,Set<T>
final class AuthorityFactories<T extends org.opengis.referencing.AuthorityFactory>
extends LazySet<T>
Provides the CRS, CS, datum and coordinate operation authority factories.
Provides also the system-wide
MultiAuthoritiesFactory instance used by CRS.forCode(String).
Current version handles the EPSG factory in a special way, but we may try to avoid doing special cases in a
future SIS version (this may require more help from ServiceLoader).- Since:
- 0.7
- Version:
- 0.8
-
Field Summary
FieldsModifier and TypeFieldDescription(package private) static final MultiAuthoritiesFactoryThe unique system-wide authority factory instance that contains all factories found on the classpath, plus the EPSG factory.private static final GeodeticAuthorityFactory[]An array containing only the EPSG factory. -
Constructor Summary
ConstructorsModifierConstructorDescriptionprivateAuthorityFactories(Class<T> type) Creates a new provider for factories of the given type. -
Method Summary
Modifier and TypeMethodDescription(package private) static GeodeticAuthorityFactoryEPSG()Returns the factory connected to the EPSG geodetic dataset if possible, or the EPSG fallback otherwise.(package private) static voidEPSG(GeodeticAuthorityFactory factory) Sets the EPSG factory to the given value.(package private) static booleanNotifies that a factory is unavailable, but without giving a fallback and without logging.(package private) static GeodeticAuthorityFactoryReturns the fallback to use if the authority factory is not available.protected T[]Invoked byLazySetfor adding the EPSG factory before any other factory fetched byServiceLoader.private static voidLogs the given exception at the given level.protected TInvoked byLazySetfor fetching the next element from the given iterator.Methods inherited from class org.apache.sis.internal.referencing.LazySet
cache, cached, isEmpty, iterator, reload, sizeMethods inherited from class org.apache.sis.internal.util.SetOfUnknownSize
equals, isSizeKnown, removeAll, spliterator, toArray, toArrayMethods inherited from class java.util.AbstractSet
hashCodeMethods inherited from class java.util.AbstractCollection
add, addAll, clear, contains, containsAll, remove, retainAll, toStringMethods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, waitMethods inherited from interface java.util.Collection
parallelStream, removeIf, stream
-
Field Details
-
EPSG
An array containing only the EPSG factory. Content of this array is initially null. The EPSG factory will be created when first needed byinitialValues(). This array is returned directly (not cloned) byinitialValues(). -
ALL
The unique system-wide authority factory instance that contains all factories found on the classpath, plus the EPSG factory. TheEPSGFactoryProxymost be excluded from this list, since the EPSG factory is handled in a special way.
-
-
Constructor Details
-
AuthorityFactories
Creates a new provider for factories of the given type.
-
-
Method Details
-
EPSG
Sets the EPSG factory to the given value. -
EPSG
Returns the factory connected to the EPSG geodetic dataset if possible, or the EPSG fallback otherwise. If an EPSG data source has been found, then this method returns an instance ofEPSGFactorybut there is no guarantee that attempts to use that factory will succeed; for example maybe the EPSG schema does not exist. Callers should be prepared to either receive anEPSGFactoryFallbackdirectly if the EPSG data source does not exist, or replace theEPSGFactoryby aEPSGFactoryFallbacklater if attempt to use the returned factory fails. -
log
Logs the given exception at the given level. This method pretends that the logging come fromCRS.getAuthorityFactory(String), which is the public facade forEPSG(). -
initialValues
Invoked byLazySetfor adding the EPSG factory before any other factory fetched byServiceLoader. We put the EPSG factory first because it is often used anyway even forCRSandAUTOnamespaces.This method tries to instantiate an
EPSGFactoryif possible, or anEPSGFactoryFallbackotherwise.- Overrides:
initialValuesin classLazySet<T extends org.opengis.referencing.AuthorityFactory>- Returns:
- the EPSG factory in an array. Callers shall not modify the returned array.
-
next
Invoked byLazySetfor fetching the next element from the given iterator. Skips theEPSGFactoryProxyif possible, or returnsnullotherwise. Note thatMultiAuthoritiesFactoryis safe to null values.
-