| java.lang.Object org.geotools.referencing.factory.AuthorityFactoryProxy
AuthorityFactoryProxy | abstract class AuthorityFactoryProxy (Code) | | Delegates object creations to one of the
create methods in a backing
. It is possible to use the generic
AuthorityFactory.createObject createObject method instead of this class,
but some factory implementations are more efficient when we use the most specific
create method. For example when using a
, invoking
CRSAuthorityFactory.createCoordinateReferenceSystemcreateCoordinateReferenceSystem instead of
AuthorityFactory.createObject createObject method will 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 don't implement the
createObject method.
Example: The following code creates a proxy which will delegates its work to the
CRSAuthorityFactory.createGeographicCRS createGeographicCRS method.
AuthorityFactory factory = ...;
AuthorityFactoryProxy proxy =
AuthorityFactoryProxy.getInstance(GeographicCRS.class, factory);
String code = ...;
// Invokes CRSAuthorityFactory.createGeographicCRS(code);
GeographicCRS crs = proxy.create(code);
since: 2.4 version: $Id: AuthorityFactoryProxy.java 26212 2007-07-12 02:34:18Z jgarnett $ author: Martin Desruisseaux |
AuthorityFactoryProxy | AuthorityFactoryProxy()(Code) | | Creates a new proxy.
|
create | abstract public IdentifiedObject create(String code) throws NoSuchAuthorityCodeException, FactoryException(Code) | | Creates an object for the specified code. This method will delegates to the most
specific
create method from the authority factory. The returned object
will always be of the type returned by
AuthorityFactoryProxy.getType() .
throws: NoSuchAuthorityCodeException - if the specified code was not found. throws: FactoryException - if the object creation failed for some other reason. |
getAuthorityCodes | final public Set getAuthorityCodes() throws FactoryException(Code) | | Returns the set of authority codes.
throws: FactoryException - if access to the underlying database failed. |
getInstance | public static AuthorityFactoryProxy getInstance(AuthorityFactory factory, Class type)(Code) | | Returns a proxy instance which will create objects of the specified type using the
specified factory.
Parameters: factory - The factory to use for object creations. Parameters: type - The type of objects to be created by the proxy. |
getType | public static Class getType(Class type) throws IllegalArgumentException(Code) | | Returns the main GeoAPI interface implemented by an object of the specified type.
The
type argument is often some implementation class like
org.geotools.referencing.crs.DefaultProjectedCRS . This method returns
the most specific GeoAPI interface implemented by
type , providing that
a corresponding
create method exists in some
. For example this method may returns
ProjectedCRS or
DerivedCRS class, but not
GeneralDerivedCRS .
Parameters: type - The implementation class. The most specific GeoAPI interface implemented by type . throws: IllegalArgumentException - if the type doesn't implement a valid interface. |
getType | abstract public Class getType()(Code) | | Returns the type of the objects to be created by this proxy instance.
|
toString | public String toString()(Code) | | Returns a string representation of this proxy, for debugging purpose only.
|
toString | final String toString(Class owner)(Code) | | Returns a string representation of the specified object, for debugging purpose only.
|
|
|