Package org.apache.sis.internal.metadata
Class Identifiers
java.lang.Object
org.apache.sis.util.Static
org.apache.sis.internal.metadata.Identifiers
Methods working on
Identifier
instances.- Since:
- 1.2
- Version:
- 1.0
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionprivate static boolean
authorityMatches
(org.opengis.metadata.Identifier identifier, org.opengis.metadata.citation.Citation authority, String codeSpace) Returnstrue
if the given identifier authority matches the givenauthority
.static String
getIdentifier
(org.opengis.metadata.citation.Citation citation, boolean strict) Infers an identifier from the given citation, or returnsnull
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.private static boolean
isDeprecated
(Object object) Returntrue
if the given object is deprecated.static boolean
Returnstrue
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.private static String
toString
(org.opengis.util.InternationalString title) Returns a "unlocalized" string representation of the given international string, ornull
if none or if the string is deprecated.
-
Constructor Details
-
Identifiers
private Identifiers()Do not allow instantiation of this class.
-
-
Method Details
-
isEPSG
Returnstrue
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, ornull
.code
- the identifier code, ornull
.- Returns:
true
if the given identifier is"IOGP:EPSG"
.- See Also:
-
isDeprecated
Returntrue
if the given object is deprecated. -
toString
Returns a "unlocalized" string representation of the given international string, ornull
if none or if the string is deprecated. This method is used bygetIdentifier(Citation, boolean)
, which is why we don't want the localized string. -
getIdentifier
Infers an identifier from the given citation, or returnsnull
if no identifier has been found. This method removes leading and trailing whitespaces. SeeCitations.getIdentifier(Citation)
for the public documentation of this method.Which method to use
Guidelines:- For information purpose (e.g. some
toString()
methods), usegetIdentifier(…, false)
. - For WKT formatting, use
getIdentifier(…, true)
in order to preserve formatting characters. - For assigning a value to a
codeSpace
field, useCitations.toCodeSpace(Citation)
.
toCodeSpace(…)
method when assigning values to be returned by methods likeReferenceIdentifier.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 ortoString()
, then we suggest to usegetIdentifier(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, ornull
.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:
- For information purpose (e.g. some
-
authorityMatches
private static boolean authorityMatches(org.opengis.metadata.Identifier identifier, org.opengis.metadata.citation.Citation authority, String codeSpace) Returnstrue
if the given identifier authority matches the givenauthority
. If one of the authority is null, then the comparison fallback on the givencodeSpace
. If the code spaces are also null, then this method conservatively returnsfalse
.- Parameters:
identifier
- the identifier to compare.authority
- the desired authority, ornull
.codeSpace
- the desired code space ornull
, used as a fallback if an authority is null.- Returns:
true
if the authority or code space (as a fallback only) matches.
-
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 isnull
or empty, then this method returnsnull
.According ISO 19162 (Well known text representation of coordinate reference systems), identifiers should have precedence over name for identifying
IdentifiedObject
s, at least in the case of operation methods and parameters.- Parameters:
id1
- the first collection of identifiers, ornull
.id2
- the second collection of identifiers, ornull
.- Returns:
TRUE
orFALSE
on match or mismatch respectively, ornull
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
-