From 95ec2b00a418176341b4aa7a7ad743e897a625f2 Mon Sep 17 00:00:00 2001 From: Grahame Grieve Date: Sun, 2 Jun 2024 21:18:58 +1000 Subject: [PATCH] add java doc --- .../main/java/org/hl7/fhir/r5/model/Base.java | 35 +++++++++++++++++-- 1 file changed, 33 insertions(+), 2 deletions(-) diff --git a/org.hl7.fhir.r5/src/main/java/org/hl7/fhir/r5/model/Base.java b/org.hl7.fhir.r5/src/main/java/org/hl7/fhir/r5/model/Base.java index 8d0e8e7e9..ca90f96e2 100644 --- a/org.hl7.fhir.r5/src/main/java/org/hl7/fhir/r5/model/Base.java +++ b/org.hl7.fhir.r5/src/main/java/org/hl7/fhir/r5/model/Base.java @@ -258,32 +258,63 @@ public abstract class Base implements Serializable, IBase, IElement { } // these 3 allow evaluation engines to get access to primitive values + + /** + * @return true if the data type is a primitive type and might have a primitive value + * (which will be accessed as a string, irrespective of the stated value) + */ public boolean isPrimitive() { return false; } + /** + * @return true if the type is boolean, and the primitive value can only be 'true' or 'false' + */ public boolean isBooleanPrimitive() { return false; } + /** + * @return true if the type is primitive, and there's value (e.g. no Data-Absent-Reason extension etc) + */ public boolean hasPrimitiveValue() { return primitiveValue() != null; } + /** + * @return the primitive value if there is one, as a string irrespective of the actual type (e.g. dates converted to their FHIR string representation) + * return null if the value is not a primitive or there is no value (might be extensions instead) + */ public String primitiveValue() { return null; } + /** + * @return true if the type is date|dateTime|instant, and the primitive value is a date/time of some precision + */ public boolean isDateTime() { return false; } + /** + * @return the date/time value if there is one, or null + */ public BaseDateTimeType dateTimeValue() { return null; } - + + /** + * @return the FHIR type name of the instance (not the java class name) + */ public abstract String fhirType() ; - + + /** + * Note that this is potentially misleading on ElementDefinition that has a 'type' + * property - don't mistakenly use this thinking it's going to look at ElementDefinition.type + * + * @param name - fhir type name + * @return- true if it 'has' this type (including by specialization) + */ public boolean hasType(String... name) { String t = fhirType(); for (String n : name) {