add java doc

This commit is contained in:
Grahame Grieve 2024-06-02 21:18:58 +10:00
parent c4585c995f
commit 95ec2b00a4
1 changed files with 33 additions and 2 deletions

View File

@ -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) {