Class AuthorityFactoryIdentifier

java.lang.Object
org.apache.sis.referencing.factory.AuthorityFactoryIdentifier

final class AuthorityFactoryIdentifier extends Object
Identification of an authority factory by its type, namespace and version.
Since:
0.7
Version:
0.7
  • Field Summary

    Fields
    Modifier and Type
    Field
    Description
    (package private) static final byte
    Factory needed is AuthorityFactory, the base interface of all factories.
    private String
    The authority of the factory, in upper case.
    (package private) static final byte
    Factory needed is CRSAuthorityFactory.
    (package private) static final byte
    Factory needed is CSAuthorityFactory.
    (package private) static final byte
    Factory needed is DatumAuthorityFactory.
    (package private) static final byte
    Factory needed is the Apache-SIS specific GeodeticAuthorityFactory.
    private static final Locale
    The locale to use for identifiers.
    (package private) static final byte
    Factory needed is CoordinateOperationAuthorityFactory.
    (package private) final byte
    The type of the factory needed, as one of the CRS, CS, DATUM, OPERATION, GEODETIC or ANY constants.
    private static final Class<? extends org.opengis.referencing.AuthorityFactory>[]
    The interfaces or abstract base classes for the above constants.
    private String
    The version part of a URI, or null if none.
  • Constructor Summary

    Constructors
    Modifier
    Constructor
    Description
    private
    AuthorityFactoryIdentifier(byte type, String authority, String version)
    Creates a new identifier for a factory of the given type, authority and version.
  • Method Summary

    Modifier and Type
    Method
    Description
    (package private) static AuthorityFactoryIdentifier
    create(byte type, String authority, String version)
    Creates a new identifier for a factory of the given type, authority and version.
    (package private) static AuthorityFactoryIdentifier
    create(Class<? extends org.opengis.referencing.AuthorityFactory> type, String authority, String version)
    Creates a new identifier for a factory of the given type, authority and version.
    boolean
    equals(Object other)
    Compares the given object with this identifier.
    (package private) CharSequence
    Returns the authority with the version, if any.
    int
    Returns a hash code value for this object.
    (package private) boolean
    Returns true if this identifier is for a specific dataset version.
    (package private) AuthorityFactoryIdentifier
    Ensures that the authority and version use shared String instances.
    (package private) boolean
    Returns true if the given identifier is for the same authority than this identifier.
    private void
    log(LogRecord record)
    Do the logging of the warning prepared by the above methods.
    (package private) void
    logConflict(org.opengis.referencing.AuthorityFactory used)
    Logs a message reporting a conflict between the factory identified by this AuthorityFactoryIdentifier and another factory, if this instance has not already logged a warning.
    (package private) void
    Logs a warning about a factory not found for the requested version, in which case AuthorityFactoryIdentifier fallback on a default version.
    (package private) AuthorityFactoryIdentifier
    newType(byte newType)
    Creates a new identifier for the same authority and version than this identifier, but a different factory.
    Returns a string representation of this identifier for debugging purpose.
    (package private) AuthorityFactoryIdentifier
    unversioned(String newAuthority)
    Returns an identifier for a factory of the same type than this identifier, but a different authority and no version.
    (package private) AuthorityFactoryIdentifier
    versionOf(org.opengis.metadata.citation.Citation factory)
    Creates a new identifier for the same type and authority than this identifier, but a different version extracted from the given authority.

    Methods inherited from class java.lang.Object

    clone, finalize, getClass, notify, notifyAll, wait, wait, wait
  • Field Details

    • IDENTIFIER_LOCALE

      private static final Locale IDENTIFIER_LOCALE
      The locale to use for identifiers. This is not necessarily the same locale than the one used for logging or error messages.
    • CRS

      static final byte CRS
      Factory needed is CRSAuthorityFactory.
      See Also:
    • CS

      static final byte CS
      Factory needed is CSAuthorityFactory.
      See Also:
    • DATUM

      static final byte DATUM
      Factory needed is DatumAuthorityFactory.
      See Also:
    • OPERATION

      static final byte OPERATION
      Factory needed is CoordinateOperationAuthorityFactory.
      See Also:
    • GEODETIC

      static final byte GEODETIC
      Factory needed is the Apache-SIS specific GeodeticAuthorityFactory.
      See Also:
    • ANY

      static final byte ANY
      Factory needed is AuthorityFactory, the base interface of all factories.
      See Also:
    • TYPES

      private static final Class<? extends org.opengis.referencing.AuthorityFactory>[] TYPES
      The interfaces or abstract base classes for the above constants.
    • type

      final byte type
      The type of the factory needed, as one of the CRS, CS, DATUM, OPERATION, GEODETIC or ANY constants.
    • authority

      private String authority
      The authority of the factory, in upper case. The upper case policy should be kept consistent with NameMeaning.AUTHORITIES.
      Example: In the "urn:ogc:def:crs:EPSG:8.2:4326" URN, this is "EPSG".
      See Also:
    • version

      private String version
      The version part of a URI, or null if none. If the version contains alphabetic characters, they should be in lower case.
      Example: In the "urn:ogc:def:crs:EPSG:8.2:4326" URN, this is "8.2".
      See Also:
  • Constructor Details

    • AuthorityFactoryIdentifier

      private AuthorityFactoryIdentifier(byte type, String authority, String version)
      Creates a new identifier for a factory of the given type, authority and version. The given authority shall be already in upper cases and the version in lower cases (this is not verified by this constructor).
  • Method Details

    • create

      static AuthorityFactoryIdentifier create(Class<? extends org.opengis.referencing.AuthorityFactory> type, String authority, String version)
      Creates a new identifier for a factory of the given type, authority and version. Only the version can be null.
    • create

      static AuthorityFactoryIdentifier create(byte type, String authority, String version)
      Creates a new identifier for a factory of the given type, authority and version. Only the version can be null.
    • unversioned

      AuthorityFactoryIdentifier unversioned(String newAuthority)
      Returns an identifier for a factory of the same type than this identifier, but a different authority and no version.
    • versionOf

      AuthorityFactoryIdentifier versionOf(org.opengis.metadata.citation.Citation factory)
      Creates a new identifier for the same type and authority than this identifier, but a different version extracted from the given authority.
      Parameters:
      factory - the factory's authority, or null for creating an identifier without version.
      Returns:
      an identifier for the version of the given authority, or this if the version is the same.
    • newType

      AuthorityFactoryIdentifier newType(byte newType)
      Creates a new identifier for the same authority and version than this identifier, but a different factory.
    • intern

      Ensures that the authority and version use shared String instances. This method is invoked only when we have determined that this AuthorityFactoryIdentifier instance will be used as a key in a hash map.
    • hashCode

      public int hashCode()
      Returns a hash code value for this object.
      Overrides:
      hashCode in class Object
    • equals

      public boolean equals(Object other)
      Compares the given object with this identifier.
      Overrides:
      equals in class Object
    • isSameAuthority

      boolean isSameAuthority(AuthorityFactoryIdentifier other)
      Returns true if the given identifier is for the same authority than this identifier.
    • getAuthorityAndVersion

      CharSequence getAuthorityAndVersion()
      Returns the authority with the version, if any.
    • hasVersion

      boolean hasVersion()
      Returns true if this identifier is for a specific dataset version.
    • logConflict

      void logConflict(org.opengis.referencing.AuthorityFactory used)
      Logs a message reporting a conflict between the factory identified by this AuthorityFactoryIdentifier and another factory, if this instance has not already logged a warning. This method assumes that it is invoked by the MultiAuthoritiesFactory.getAuthorityFactory(…) method.
      Parameters:
      used - the factory which will be used.
    • logFallback

      void logFallback()
      Logs a warning about a factory not found for the requested version, in which case AuthorityFactoryIdentifier fallback on a default version.
    • log

      private void log(LogRecord record)
      Do the logging of the warning prepared by the above methods. This method declares MultiAuthoritiesFactory.getAuthorityFactory(…) as the source of the log since it is the nearest public API.
    • toString

      public String toString()
      Returns a string representation of this identifier for debugging purpose.
      Overrides:
      toString in class Object