Skip to content
This repository has been archived by the owner on Sep 15, 2023. It is now read-only.

Commit

Permalink
Make standardized family name optional
Browse files Browse the repository at this point in the history
  • Loading branch information
M-Wong committed Jul 19, 2022
1 parent d951f5c commit d8a285b
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 4 deletions.
2 changes: 1 addition & 1 deletion gradle.properties
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ kotlin.code.style=official
# Artifact metadata
GROUP=ch.admin.bag.covidcertificate
POM_ARTIFACT_ID=sdk-core
VERSION_NAME=3.2.0
VERSION_NAME=3.2.1

# POM metadata
POM_NAME=sdk-core
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,17 +18,17 @@ import java.io.Serializable
@JsonClass(generateAdapter = true)
data class PersonName(
@Json(name = "fn") @get:JsonProperty("fn") val familyName: String?,
@Json(name = "fnt") @get:JsonProperty("fnt") val standardizedFamilyName: String,
@Json(name = "fnt") @get:JsonProperty("fnt") val standardizedFamilyName: String?,
@Json(name = "gn") @get:JsonProperty("gn") val givenName: String?,
@Json(name = "gnt") @get:JsonProperty("gnt") val standardizedGivenName: String?,
) : Serializable {

fun prettyFamilyName(): String = familyName ?: standardizedFamilyName
fun prettyFamilyName(): String = familyName ?: (standardizedFamilyName ?: "")

fun prettyGivenName(): String = givenName ?: (standardizedGivenName ?: "")

fun prettyName(): String = "${prettyFamilyName()} ${prettyGivenName()}"

// Don't fall back to the givenName if the standardizedGivenName is null, since the givenName can reasonably contain non-standard characters.
fun prettyStandardizedName(): String = "${standardizedFamilyName}<<${standardizedGivenName ?: ""}"
fun prettyStandardizedName(): String = "${standardizedFamilyName ?: ""}<<${standardizedGivenName ?: ""}"
}

0 comments on commit d8a285b

Please sign in to comment.