Class AuthorityFactoryProxy<T>
java.lang.Object
org.apache.sis.referencing.factory.AuthorityFactoryProxy<T>
- Direct Known Subclasses:
MultiAuthoritiesFactory.Deferred
Delegates object creations to one of the
create
methods in a backing AuthorityFactory
.
It is possible to use the generic AuthorityFactory.createObject(String)
method instead of this class,
but some factories are more efficient when we use the most specific create
method.
For example, when using a EPSGDataAccess,
invoking GeodeticAuthorityFactory.createProjectedCRS(String)
instead of
AuthorityFactory.createObject(String)
method reduce the amount of tables to be queried.
This class is useful when the same create
method need to be invoked often, but is unknown at compile time.
It may also be used as a workaround for authority factories that do not implement the createObject(String)
method.
Example:
the following code creates a proxy which will delegates its work to the
createGeographicCRS
method.
- Since:
- 0.7
- Version:
- 0.7
-
Field Summary
FieldsModifier and TypeFieldDescription(package private) static final AuthorityFactoryProxy<org.opengis.referencing.cs.CoordinateSystemAxis>
private static final Map<String,
AuthorityFactoryProxy<?>> The proxy to use for a given type declared in a URN.(package private) static final AuthorityFactoryProxy<org.opengis.referencing.cs.CartesianCS>
(package private) static final AuthorityFactoryProxy<org.opengis.referencing.crs.CompoundCRS>
(package private) static final AuthorityFactoryProxy<org.opengis.referencing.cs.CoordinateSystem>
(package private) static final AuthorityFactoryProxy<org.opengis.referencing.crs.CoordinateReferenceSystem>
(package private) static final AuthorityFactoryProxy<org.opengis.referencing.cs.CylindricalCS>
(package private) static final AuthorityFactoryProxy<org.opengis.referencing.datum.Datum>
(package private) static final AuthorityFactoryProxy<org.opengis.referencing.crs.DerivedCRS>
(package private) static final AuthorityFactoryProxy<org.opengis.util.InternationalString>
The proxy for theGeodeticAuthorityFactory.getDescriptionText(String)
method.(package private) static final AuthorityFactoryProxy<org.opengis.referencing.datum.Ellipsoid>
(package private) static final AuthorityFactoryProxy<org.opengis.referencing.cs.EllipsoidalCS>
(package private) static final AuthorityFactoryProxy<org.opengis.referencing.crs.EngineeringCRS>
(package private) static final AuthorityFactoryProxy<org.opengis.referencing.datum.EngineeringDatum>
(package private) static final AuthorityFactoryProxy<org.opengis.metadata.extent.Extent>
(package private) final byte
The type of factory needed for creating objects, as one of the constants defined inAuthorityFactoryIdentifier
.(package private) static final AuthorityFactoryProxy<org.opengis.referencing.crs.GeocentricCRS>
(package private) static final AuthorityFactoryProxy<org.opengis.referencing.datum.GeodeticDatum>
(package private) static final AuthorityFactoryProxy<org.opengis.referencing.crs.GeographicCRS>
(package private) static final AuthorityFactoryProxy<org.opengis.referencing.crs.ImageCRS>
(package private) static final AuthorityFactoryProxy<org.opengis.referencing.datum.ImageDatum>
(package private) static final AuthorityFactoryProxy<org.opengis.referencing.operation.OperationMethod>
(package private) static final AuthorityFactoryProxy<org.opengis.referencing.IdentifiedObject>
The proxy for theGeodeticAuthorityFactory.createObject(String)
method.(package private) static final AuthorityFactoryProxy<org.opengis.referencing.operation.CoordinateOperation>
(package private) static final AuthorityFactoryProxy<org.opengis.parameter.ParameterDescriptor>
(package private) static final AuthorityFactoryProxy<org.opengis.referencing.cs.PolarCS>
(package private) static final AuthorityFactoryProxy<org.opengis.referencing.datum.PrimeMeridian>
(package private) static final AuthorityFactoryProxy<org.opengis.referencing.crs.ProjectedCRS>
(package private) static final AuthorityFactoryProxy<?>[]
The list of all proxies.(package private) static final AuthorityFactoryProxy<org.opengis.referencing.cs.SphericalCS>
(package private) static final AuthorityFactoryProxy<org.opengis.referencing.crs.TemporalCRS>
(package private) static final AuthorityFactoryProxy<org.opengis.referencing.datum.TemporalDatum>
(package private) static final AuthorityFactoryProxy<org.opengis.referencing.cs.TimeCS>
The type of objects to be created.(package private) static final AuthorityFactoryProxy<javax.measure.Unit<?>>
(package private) static final AuthorityFactoryProxy<org.opengis.referencing.crs.VerticalCRS>
(package private) static final AuthorityFactoryProxy<org.opengis.referencing.cs.VerticalCS>
(package private) static final AuthorityFactoryProxy<org.opengis.referencing.datum.VerticalDatum>
-
Constructor Summary
ConstructorsConstructorDescriptionAuthorityFactoryProxy
(Class<T> type, byte factoryType) Creates a new proxy for objects of the given type. -
Method Summary
Modifier and TypeMethodDescription(package private) T
create
(GeodeticAuthorityFactory factory, String code) Creates the object for the given code.(package private) abstract T
createFromAPI
(org.opengis.referencing.AuthorityFactory factory, String code) Creates the object for the given code using only GeoAPI interfaces.(package private) final org.opengis.referencing.crs.CRSAuthorityFactory
crsFactory
(org.opengis.referencing.AuthorityFactory factory) Casts the given factory into a CRS authority factory, or throws aFactoryException
if the given factory is not of the expected type.(package private) final org.opengis.referencing.cs.CSAuthorityFactory
csFactory
(org.opengis.referencing.AuthorityFactory factory) Casts the given factory into a CS authority factory, or throws aFactoryException
if the given factory is not of the expected type.(package private) final org.opengis.referencing.datum.DatumAuthorityFactory
datumFactory
(org.opengis.referencing.AuthorityFactory factory) Casts the given factory into a datum authority factory, or throws aFactoryException
if the given factory is not of the expected type.private static org.opengis.util.FactoryException
factoryNotFound
(Class<? extends org.opengis.referencing.AuthorityFactory> type) Returns the exception to be thrown when a factory is not found.(package private) final GeodeticAuthorityFactory
geodeticFactory
(org.opengis.referencing.AuthorityFactory factory) Casts the given factory into a geodetic authority factory, or throws aFactoryException
if the given factory is not of the expected type.(package private) static <T> AuthorityFactoryProxy<? super T>
getInstance
(Class<T> type) Returns the instance for the given type.(package private) final org.opengis.referencing.operation.CoordinateOperationAuthorityFactory
opFactory
(org.opengis.referencing.AuthorityFactory factory) Casts the given factory into an operation authority factory, or throws aFactoryException
if the given factory is not of the expected type.(package private) AuthorityFactoryProxy<? extends T>
specialize
(String typeName) The proxy to use for a given type declared in a URN.toString()
Returns a string representation for debugging purpose.
-
Field Details
-
type
The type of objects to be created. -
factoryType
final byte factoryTypeThe type of factory needed for creating objects, as one of the constants defined inAuthorityFactoryIdentifier
. -
DESCRIPTION
The proxy for theGeodeticAuthorityFactory.getDescriptionText(String)
method. -
OBJECT
The proxy for theGeodeticAuthorityFactory.createObject(String)
method. -
DATUM
-
ENGINEERING_DATUM
static final AuthorityFactoryProxy<org.opengis.referencing.datum.EngineeringDatum> ENGINEERING_DATUM -
IMAGE_DATUM
-
VERTICAL_DATUM
-
TEMPORAL_DATUM
-
GEODETIC_DATUM
-
ELLIPSOID
-
PRIME_MERIDIAN
-
EXTENT
-
COORDINATE_SYSTEM
-
CARTESIAN_CS
-
POLAR_CS
-
CYLINDRICAL_CS
-
SPHERICAL_CS
-
ELLIPSOIDAL_CS
-
VERTICAL_CS
-
TIME_CS
-
AXIS
-
UNIT
-
CRS
-
COMPOUND_CRS
-
DERIVED_CRS
-
ENGINEERING_CRS
-
GEOGRAPHIC_CRS
-
GEOCENTRIC_CRS
-
IMAGE_CRS
-
PROJECTED_CRS
-
TEMPORAL_CRS
-
VERTICAL_CRS
-
PARAMETER
-
METHOD
-
OPERATION
-
PROXIES
The list of all proxies. The most specific types must appear first in this array, with a preference for those who are more likely to be requested. This field can be declared only after all the above constants. -
BY_URN_TYPE
The proxy to use for a given type declared in a URN. For example in the"urn:ogc:def:crs:EPSG::4326"
URN, the proxy to use isCRS
.Keys must be in lower case.
-
-
Constructor Details
-
AuthorityFactoryProxy
Creates a new proxy for objects of the given type.
-
-
Method Details
-
toString
Returns a string representation for debugging purpose. -
datumFactory
final org.opengis.referencing.datum.DatumAuthorityFactory datumFactory(org.opengis.referencing.AuthorityFactory factory) throws org.opengis.util.FactoryException Casts the given factory into a datum authority factory, or throws aFactoryException
if the given factory is not of the expected type.- Throws:
org.opengis.util.FactoryException
-
csFactory
final org.opengis.referencing.cs.CSAuthorityFactory csFactory(org.opengis.referencing.AuthorityFactory factory) throws org.opengis.util.FactoryException Casts the given factory into a CS authority factory, or throws aFactoryException
if the given factory is not of the expected type.- Throws:
org.opengis.util.FactoryException
-
crsFactory
final org.opengis.referencing.crs.CRSAuthorityFactory crsFactory(org.opengis.referencing.AuthorityFactory factory) throws org.opengis.util.FactoryException Casts the given factory into a CRS authority factory, or throws aFactoryException
if the given factory is not of the expected type.- Throws:
org.opengis.util.FactoryException
-
opFactory
final org.opengis.referencing.operation.CoordinateOperationAuthorityFactory opFactory(org.opengis.referencing.AuthorityFactory factory) throws org.opengis.util.FactoryException Casts the given factory into an operation authority factory, or throws aFactoryException
if the given factory is not of the expected type.- Throws:
org.opengis.util.FactoryException
-
geodeticFactory
final GeodeticAuthorityFactory geodeticFactory(org.opengis.referencing.AuthorityFactory factory) throws org.opengis.util.FactoryException Casts the given factory into a geodetic authority factory, or throws aFactoryException
if the given factory is not of the expected type.- Throws:
org.opengis.util.FactoryException
-
factoryNotFound
private static org.opengis.util.FactoryException factoryNotFound(Class<? extends org.opengis.referencing.AuthorityFactory> type) Returns the exception to be thrown when a factory is not found. -
create
Creates the object for the given code.- Parameters:
factory
- the factory to use for creating the object.code
- the code for which to create an object.- Returns:
- the object created from the given code.
- Throws:
org.opengis.util.FactoryException
- if an error occurred while creating the object.
-
createFromAPI
abstract T createFromAPI(org.opengis.referencing.AuthorityFactory factory, String code) throws org.opengis.util.FactoryException Creates the object for the given code using only GeoAPI interfaces. This method is slightly less efficient than the abovecreate(org.apache.sis.referencing.factory.GeodeticAuthorityFactory, java.lang.String)
method.- Parameters:
factory
- the factory to use for creating the object.code
- the code for which to create an object.- Returns:
- the object created from the given code.
- Throws:
org.opengis.util.FactoryException
- if an error occurred while creating the object.
-
getInstance
static <T> AuthorityFactoryProxy<? super T> getInstance(Class<T> type) throws IllegalArgumentException Returns the instance for the given type. Thetype
argument can be a GeoAPI interface or some implementation class likeDefaultProjectedCRS
. This method returns the most specific proxy for the given type.- Parameters:
type
- the GeoAPI or implementation class.- Returns:
- the most specific proxy for the given
type
. - Throws:
IllegalArgumentException
- if the type does not implement a valid interface.
-
specialize
The proxy to use for a given type declared in a URN. For example in the"urn:ogc:def:crs:EPSG::4326"
URN, the proxy to use isCRS
.- Parameters:
typeName
- the name of URN type.- Returns:
- the proxy for the given type, or
null
if the given type is illegal.
-