From 8ebfe45ad53ed207c5de15c1367bed58278206a1 Mon Sep 17 00:00:00 2001 From: Grahame Grieve Date: Mon, 5 Aug 2019 11:32:48 +1000 Subject: [PATCH] add sugar StructureDefinition.describeType --- .../org/hl7/fhir/r5/model/StructureDefinition.java | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/org.hl7.fhir.r5/src/main/java/org/hl7/fhir/r5/model/StructureDefinition.java b/org.hl7.fhir.r5/src/main/java/org/hl7/fhir/r5/model/StructureDefinition.java index 956297c82..541be965f 100644 --- a/org.hl7.fhir.r5/src/main/java/org/hl7/fhir/r5/model/StructureDefinition.java +++ b/org.hl7.fhir.r5/src/main/java/org/hl7/fhir/r5/model/StructureDefinition.java @@ -3885,5 +3885,18 @@ public class StructureDefinition extends MetadataResource { */ public static final ca.uhn.fhir.model.api.Include INCLUDE_BASE = new ca.uhn.fhir.model.api.Include("StructureDefinition:base").toLocked(); +public String describeType() { + if ("Extension".equals(getType())) + return "Extension" ; + switch (getKind()) { + case COMPLEXTYPE: return getDerivation() == TypeDerivationRule.CONSTRAINT ? "DataType Constraint" : "DataType" ; + case LOGICAL: return getDerivation() == TypeDerivationRule.CONSTRAINT ? "Logical Model" : "Logical Model Profile"; + case PRIMITIVETYPE: return getDerivation() == TypeDerivationRule.CONSTRAINT ? "Type Constraint" : "Type"; + case RESOURCE: return getDerivation() == TypeDerivationRule.CONSTRAINT ? "Resource Profile" : "Resource"; + default: + return "Definition"; + } +} + }