Class Identifiers

java.lang.Object
org.apache.sis.util.Static
org.apache.sis.internal.metadata.Identifiers

public final class Identifiers extends Static
Methods working on Identifier instances.
Since:
1.2
Version:
1.0
Author:
Martin Desruisseaux (Geomatys)
  • Method Summary

    Modifier and Type
    Method
    Description
    static String
    getIdentifier(org.opengis.metadata.citation.Citation citation, boolean strict)
    Infers an identifier from the given citation, or returns null if no identifier has been found.
    static Boolean
    hasCommonIdentifier(Iterable<? extends org.opengis.referencing.ReferenceIdentifier> id1, Iterable<? extends org.opengis.referencing.ReferenceIdentifier> id2)
    Determines whether a match or mismatch is found between the two given collections of identifiers.
    static boolean
    isEPSG(String codeSpace, String code)
    Returns true if the given code is "EPSG" while the codespace is "IOGP" or "OGP" (ignoring case).
    static String
    missingValueForProperty(org.opengis.metadata.Identifier owner, String property)
    Returns a message saying that a property is missing for an object having the given identifier.

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Method Details

    • isEPSG

      public static boolean isEPSG(String codeSpace, String code)
      Returns true if the given code is "EPSG" while the codespace is "IOGP" or "OGP" (ignoring case). This particular combination of code and codespace is handled in a special way.

      This method can be used for identifying where in Apache SIS source code the relationship between EPSG authority and IOGP code space is hard-coded.

      Parameters:
      codeSpace - the identifier code space, or null.
      code - the identifier code, or null.
      Returns:
      true if the given identifier is "IOGP:EPSG".
      See Also:
    • getIdentifier

      public static String getIdentifier(org.opengis.metadata.citation.Citation citation, boolean strict)
      Infers an identifier from the given citation, or returns null if no identifier has been found. This method removes leading and trailing whitespaces. See Citations.getIdentifier(Citation) for the public documentation of this method.

      Which method to use

      Guidelines:
      • For information purpose (e.g. some toString() methods), use getIdentifier(…, false).
      • For WKT formatting, use getIdentifier(…, true) in order to preserve formatting characters.
      • For assigning a value to a codeSpace field, use Citations.toCodeSpace(Citation).
      Use toCodeSpace(…) method when assigning values to be returned by methods like ReferenceIdentifier.getCodeSpace(), since those values are likely to be compared without special care about ignorable identifier characters. But if the intent is to format a more complex string like WKT or toString(), then we suggest to use getIdentifier(citation, true) instead, which will produce the same result but preserving the ignorable characters, which can be useful for formatting purpose.
      Parameters:
      citation - the citation for which to get the identifier, or null.
      strict - true for returning a non-null value only if the identifier is a valid Unicode identifier.
      Returns:
      a non-empty identifier for the given citation without leading or trailing whitespaces, or null if the given citation is null or does not declare any identifier or title.
      See Also:
    • hasCommonIdentifier

      public static Boolean hasCommonIdentifier(Iterable<? extends org.opengis.referencing.ReferenceIdentifier> id1, Iterable<? extends org.opengis.referencing.ReferenceIdentifier> id2)
      Determines whether a match or mismatch is found between the two given collections of identifiers. If any of the given collections is null or empty, then this method returns null.

      According ISO 19162 (Well known text representation of coordinate reference systems), identifiers should have precedence over name for identifying IdentifiedObjects, at least in the case of operation methods and parameters.

      Parameters:
      id1 - the first collection of identifiers, or null.
      id2 - the second collection of identifiers, or null.
      Returns:
      TRUE or FALSE on match or mismatch respectively, or null if this method cannot determine if there is a match or mismatch.
    • missingValueForProperty

      public static String missingValueForProperty(org.opengis.metadata.Identifier owner, String property)
      Returns a message saying that a property is missing for an object having the given identifier.
      Parameters:
      owner - identifier of the object for which a property is missing.
      property - name of the missing property.
      Returns:
      a message saying that a value is missing for the given property in the specified identified object.
      Since:
      1.2