Java Code Examples for org.hl7.fhir.dstu3.model.ElementDefinition#hasMaxElement()

The following examples show how to use org.hl7.fhir.dstu3.model.ElementDefinition#hasMaxElement() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: ProfileUtilities.java    From org.hl7.fhir.core with Apache License 2.0 5 votes vote down vote up
private String describeCardinality(ElementDefinition definition, ElementDefinition fallback, UnusedTracker tracker) {
  IntegerType min = definition.hasMinElement() ? definition.getMinElement() : new IntegerType();
  StringType max = definition.hasMaxElement() ? definition.getMaxElement() : new StringType();
  if (min.isEmpty() && fallback != null)
    min = fallback.getMinElement();
  if (max.isEmpty() && fallback != null)
    max = fallback.getMaxElement();

  tracker.used = !max.isEmpty() && !max.getValue().equals("0");

  if (min.isEmpty() && max.isEmpty())
    return null;
  else
    return (!min.hasValue() ? "" : Integer.toString(min.getValue())) + ".." + (!max.hasValue() ? "" : max.getValue());
}
 
Example 2
Source File: ProfileUtilities.java    From org.hl7.fhir.core with Apache License 2.0 4 votes vote down vote up
private boolean isSlicedToOneOnly(ElementDefinition e) {
  return (e.hasSlicing() && e.hasMaxElement() && e.getMax().equals("1"));
}