Package org.hl7.fhir.utilities
Class CanonicalPair
java.lang.Object
org.hl7.fhir.utilities.CanonicalPair
Abstraction that splits a canonical in form of
<url>|<version> into a URL and a version part.-
Constructor Summary
ConstructorsConstructorDescriptionCanonicalPair(String target) Wraps the given canonical and if needed splits off the version part. -
Method Summary
Modifier and TypeMethodDescriptiongetUrl()Returns the URL part of the canonical (everything before the"|"character, or the complete canonical if the character is not present).Returns the version part of the source canonical (everything after the"|"character.getVersionOr(String alternative) Returns the version of this pair, or the parameteralternative, if the version of this pair isnull.booleanDetermines if the encapsulated version of this pair is notnulland not an empty string.booleanDetermines if the version part of the canonical is notnullstatic CanonicalPairStatic factory method, that invokes theCanonicalPair constructorwith the given argument.
-
Constructor Details
-
CanonicalPair
Wraps the given canonical and if needed splits off the version part.The given parameter
targetis expected to be a canonical.- Parameters:
target- canonical to create a url, version pair from. May benull.
-
-
Method Details
-
of
Static factory method, that invokes theCanonicalPair constructorwith the given argument.- Parameters:
target- the canonical to be split. May benull.- Returns:
- new instance of CanonicalPair
-
getUrl
Returns the URL part of the canonical (everything before the"|"character, or the complete canonical if the character is not present). If the source- Returns:
- URL part of the source canonical. May be
null, if source canonical wasnull
-
getVersion
Returns the version part of the source canonical (everything after the"|"character.- Returns:
- version part of the canonical, may be
null, if canonical wasnull, or canonical contains no"|"character.
-
hasVersion
Determines if the version part of the canonical is notnull- Returns:
trueif version is notnull, otherwisefalse
-
getVersionOr
Returns the version of this pair, or the parameteralternative, if the version of this pair isnull.- Parameters:
alternative- to be returned from this method if the encapsulated version isnull.- Returns:
- either the held version, or
alternative, if version isnull
-
hasNonEmptyVersion
Determines if the encapsulated version of this pair is notnulland not an empty string.- Returns:
trueif the version of this pair is notnulland not an empty string,falseotherwise
-