Class FHIRPathUtil


  • public final class FHIRPathUtil
    extends java.lang.Object
    • Field Detail

      • STRING_TRUE_VALUES

        public static final java.util.Set<java.lang.String> STRING_TRUE_VALUES
      • STRING_FALSE_VALUES

        public static final java.util.Set<java.lang.String> STRING_FALSE_VALUES
      • INTEGER_TRUE

        public static final java.lang.Integer INTEGER_TRUE
      • INTEGER_FALSE

        public static final java.lang.Integer INTEGER_FALSE
      • DECIMAL_TRUE

        public static final java.math.BigDecimal DECIMAL_TRUE
      • DECIMAL_FALSE

        public static final java.math.BigDecimal DECIMAL_FALSE
      • UNESCAPED

        public static final java.util.Map<java.lang.String,​java.lang.String> UNESCAPED
    • Method Detail

      • isResourceNode

        public static boolean isResourceNode​(java.util.Collection<FHIRPathNode> nodes)
      • isElementNode

        public static boolean isElementNode​(java.util.Collection<FHIRPathNode> nodes)
      • isCodedElementNode

        public static boolean isCodedElementNode​(java.util.Collection<FHIRPathNode> nodes)
      • isCodedElementNode

        public static boolean isCodedElementNode​(FHIRPathElementNode elementNode)
      • isCodedElement

        public static boolean isCodedElement​(Element element)
      • isStringElementNode

        public static boolean isStringElementNode​(java.util.Collection<FHIRPathNode> nodes)
      • isStringElementNode

        public static boolean isStringElementNode​(FHIRPathElementNode elementNode)
      • isUriElementNode

        public static boolean isUriElementNode​(java.util.Collection<FHIRPathNode> nodes)
      • isQuantityNode

        public static boolean isQuantityNode​(java.util.Collection<FHIRPathNode> nodes)
      • getDecimal

        public static java.math.BigDecimal getDecimal​(java.util.Collection<FHIRPathNode> nodes)
      • getInteger

        public static java.lang.Integer getInteger​(java.util.Collection<FHIRPathNode> nodes)
      • getString

        public static java.lang.String getString​(java.util.Collection<FHIRPathNode> nodes)
      • getBoolean

        public static java.lang.Boolean getBoolean​(java.util.Collection<FHIRPathNode> nodes)
      • getDate

        public static java.time.temporal.TemporalAccessor getDate​(java.util.Collection<FHIRPathNode> nodes)
      • getDateTime

        public static java.time.temporal.TemporalAccessor getDateTime​(java.util.Collection<FHIRPathNode> nodes)
      • getTime

        public static java.time.temporal.TemporalAccessor getTime​(java.util.Collection<FHIRPathNode> nodes)
      • hasSystemValue

        public static boolean hasSystemValue​(java.util.Collection<FHIRPathNode> nodes)
      • hasSystemValue

        public static boolean hasSystemValue​(FHIRPathNode node)
      • hasBooleanValue

        public static boolean hasBooleanValue​(java.util.Collection<FHIRPathNode> nodes)
      • hasNumberValue

        public static boolean hasNumberValue​(java.util.Collection<FHIRPathNode> nodes)
      • hasDecimalValue

        public static boolean hasDecimalValue​(java.util.Collection<FHIRPathNode> nodes)
      • hasIntegerValue

        public static boolean hasIntegerValue​(java.util.Collection<FHIRPathNode> nodes)
      • hasTemporalValue

        public static boolean hasTemporalValue​(java.util.Collection<FHIRPathNode> nodes)
      • hasDateValue

        public static boolean hasDateValue​(java.util.Collection<FHIRPathNode> nodes)
      • hasDateTimeValue

        public static boolean hasDateTimeValue​(java.util.Collection<FHIRPathNode> nodes)
      • hasTimeValue

        public static boolean hasTimeValue​(java.util.Collection<FHIRPathNode> nodes)
      • hasStringValue

        public static boolean hasStringValue​(java.util.Collection<FHIRPathNode> nodes)
      • hasQuantityValue

        public static boolean hasQuantityValue​(java.util.Collection<FHIRPathNode> nodes)
      • evaluatesToBoolean

        public static boolean evaluatesToBoolean​(java.util.Collection<FHIRPathNode> nodes)
      • evaluatesToTrue

        public static boolean evaluatesToTrue​(java.util.Collection<FHIRPathNode> nodes)
        Indicates whether the input collection evaluates to a boolean value per: Singleton Evaluation of Collections
        Parameters:
        nodes - the input collection
        Returns:
        true if the input collection evaluates to a boolean value, false otherwise
      • convertsToBoolean

        public static boolean convertsToBoolean​(java.util.Collection<FHIRPathNode> nodes)
        Indicates whether the input collection can be implicitly or explicitly converted to a boolean value per: Boolean Conversion Functions
        Parameters:
        nodes - the input collection
        Returns:
        true if the input collection can be explicitly or implicitly converted to a boolean value, false otherwise
      • toBoolean

        public static boolean toBoolean​(java.util.Collection<FHIRPathNode> nodes)
      • convertsToDate

        public static boolean convertsToDate​(java.util.Collection<FHIRPathNode> nodes)
      • convertsToDateTime

        public static boolean convertsToDateTime​(java.util.Collection<FHIRPathNode> nodes)
      • convertsToTime

        public static boolean convertsToTime​(java.util.Collection<FHIRPathNode> nodes)
      • isSingleton

        public static boolean isSingleton​(java.util.Collection<FHIRPathNode> nodes)
      • isSingleton

        public static <T extends FHIRPathNode> boolean isSingleton​(java.util.Collection<FHIRPathNode> nodes,
                                                                   java.lang.Class<T> nodeType)
      • isSystemValue

        public static boolean isSystemValue​(java.util.Collection<FHIRPathNode> nodes)
      • isStringValue

        public static boolean isStringValue​(java.util.Collection<FHIRPathNode> nodes)
      • isBooleanValue

        public static boolean isBooleanValue​(java.util.Collection<FHIRPathNode> nodes)
      • isIntegerValue

        public static boolean isIntegerValue​(java.util.Collection<FHIRPathNode> nodes)
      • isDecimalValue

        public static boolean isDecimalValue​(java.util.Collection<FHIRPathNode> nodes)
      • getSingleton

        public static FHIRPathNode getSingleton​(java.util.Collection<FHIRPathNode> nodes)
        Throws:
        java.lang.IllegalArgumentException - if the passed collection is not a singleton
      • getSingleton

        public static <T extends FHIRPathNode> T getSingleton​(java.util.Collection<FHIRPathNode> nodes,
                                                              java.lang.Class<T> nodeType)
      • empty

        public static java.util.Collection<FHIRPathNode> empty()
      • getTemporalAccessor

        public static java.time.temporal.TemporalAccessor getTemporalAccessor​(java.time.temporal.Temporal temporal,
                                                                              java.lang.Class<?> targetType)
      • getTemporal

        public static java.time.temporal.Temporal getTemporal​(java.time.temporal.TemporalAccessor temporalAccessor)
      • getTemporalAmount

        public static java.time.temporal.TemporalAmount getTemporalAmount​(FHIRPathQuantityValue quantityValue)
      • getChronoUnit

        public static java.time.temporal.ChronoUnit getChronoUnit​(java.lang.String unit)
      • buildTupleTypeInfo

        public static TupleTypeInfo buildTupleTypeInfo​(java.lang.Class<?> modelClass)
      • isOrdered

        public static boolean isOrdered​(java.util.Collection<FHIRPathNode> nodes)
      • isUnordered

        public static boolean isUnordered​(java.util.Collection<FHIRPathNode> nodes)
      • getPrecision

        public static java.time.temporal.ChronoField getPrecision​(java.time.temporal.TemporalAccessor temporalAccessor)
      • getPrecision

        public static java.time.temporal.ChronoField getPrecision​(java.time.temporal.TemporalAccessor temporalAccessor,
                                                                  java.lang.String text)
      • hasTemporalValue

        public static boolean hasTemporalValue​(FHIRPathNode node)
      • unescape

        public static java.lang.String unescape​(java.lang.String s)
      • add

        public static <T extends Visitable> T add​(T elementOrResource,
                                                  java.lang.String fhirPath,
                                                  java.lang.String elementName,
                                                  Visitable value)
                                           throws FHIRPathException,
                                                  FHIRPatchException
        The content will be appended to the element identified in the path, using the name specified. Add can used for non-repeating elements as long as they do not already exist.
        Throws:
        FHIRPathException
        FHIRPatchException
        java.lang.NullPointerException - if any of the passed arguments are null
      • insert

        public static <T extends Visitable> T insert​(T elementOrResource,
                                                     java.lang.String fhirPath,
                                                     int index,
                                                     Visitable value)
                                              throws FHIRPathException,
                                                     FHIRPatchException
        The content will be inserted into the nominated list at the index specified (0 based). The index is mandatory and must be equal or less than the number of elements in the list. Note: add is easier than insert at the end of the list.
        Throws:
        FHIRPathException
        FHIRPatchException
        java.lang.NullPointerException - if any of the passed arguments are null
      • getResourceNode

        public static FHIRPathResourceNode getResourceNode​(FHIRPathTree tree,
                                                           FHIRPathNode node)
        Get the resource node to use as a value for the %resource external constant.
        Parameters:
        tree - the FHIRPath tree
        node - the context node
        Returns:
        the resource node, or null if not exists
      • getRootResourceNode

        public static FHIRPathResourceNode getRootResourceNode​(FHIRPathTree tree,
                                                               FHIRPathNode node)
        Get the resource node to use as a value for the %rootResource external constant.
        Parameters:
        tree - the FHIRPath tree
        node - the context node
        Returns:
        the rootResource node, or null if not exists
      • getSystem

        public static Uri getSystem​(FHIRPathTree tree,
                                    FHIRPathElementNode elementNode)
        Get the URI-typed sibling of the given element node with name "system".
        Parameters:
        tree - the tree
        elementNode - the element node
        Returns:
        the URI-typed sibling of the given element node with name "system", or null if no such sibling exists
      • getVersion

        public static String getVersion​(FHIRPathTree tree,
                                        FHIRPathElementNode elementNode)
        Get the String-typed sibling of the given element node with name "version".
        Parameters:
        tree - the tree
        elementNode - the element node
        Returns:
        the String-typed sibling of the given element node with name "version", or null if no such sibling exists
      • getDisplay

        public static String getDisplay​(FHIRPathTree tree,
                                        FHIRPathElementNode elementNode)
        Get the String-typed sibling of the given element node with name "display".
        Parameters:
        tree - the tree
        elementNode - the element node
        Returns:
        the String-typed sibling of the given element node with name "display", or null if no such sibling exists
      • isStringSubType

        public static boolean isStringSubType​(FHIRPathNode node)
        returns true if the node is a String or if FHIR element can be automatically converted to System.String https://www.hl7.org/fhir/fhirpath.html#types
        Parameters:
        node -
        Returns:
        boolean