Package com.ibm.fhir.path.util
Class FHIRPathUtil
- java.lang.Object
-
- com.ibm.fhir.path.util.FHIRPathUtil
-
public final class FHIRPathUtil extends Object
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static class
FHIRPathUtil.UnorderedCollection
-
Field Summary
Fields Modifier and Type Field Description static BigDecimal
DECIMAL_FALSE
static BigDecimal
DECIMAL_TRUE
static Integer
INTEGER_FALSE
static Integer
INTEGER_TRUE
static Set<String>
STRING_FALSE_VALUES
static Set<String>
STRING_TRUE_VALUES
static Map<String,String>
UNESCAPED
-
Method Summary
-
-
-
Field Detail
-
INTEGER_TRUE
public static final Integer INTEGER_TRUE
-
INTEGER_FALSE
public static final Integer INTEGER_FALSE
-
DECIMAL_TRUE
public static final BigDecimal DECIMAL_TRUE
-
DECIMAL_FALSE
public static final BigDecimal DECIMAL_FALSE
-
-
Method Detail
-
compile
public static FHIRPathParser.ExpressionContext compile(String expr)
-
isTypeCompatible
public static boolean isTypeCompatible(FHIRPathSystemValue leftValue, FHIRPathSystemValue rightValue)
-
isResourceNode
public static boolean isResourceNode(Collection<FHIRPathNode> nodes)
-
getResourceNode
public static FHIRPathResourceNode getResourceNode(Collection<FHIRPathNode> nodes)
-
isElementNode
public static boolean isElementNode(Collection<FHIRPathNode> nodes)
-
getElementNode
public static FHIRPathElementNode getElementNode(Collection<FHIRPathNode> nodes)
-
isCodedElementNode
public static boolean isCodedElementNode(Collection<FHIRPathNode> nodes)
-
isCodedElementNode
public static boolean isCodedElementNode(FHIRPathElementNode elementNode)
-
isCodedElement
public static boolean isCodedElement(Element element)
-
isStringElementNode
public static boolean isStringElementNode(Collection<FHIRPathNode> nodes)
-
isStringElementNode
public static boolean isStringElementNode(FHIRPathElementNode elementNode)
-
isUriElementNode
public static boolean isUriElementNode(Collection<FHIRPathNode> nodes)
-
isQuantityNode
public static boolean isQuantityNode(Collection<FHIRPathNode> nodes)
-
getQuantityNode
public static FHIRPathQuantityNode getQuantityNode(Collection<FHIRPathNode> nodes)
-
getDecimal
public static BigDecimal getDecimal(Collection<FHIRPathNode> nodes)
-
getInteger
public static Integer getInteger(Collection<FHIRPathNode> nodes)
-
getString
public static String getString(Collection<FHIRPathNode> nodes)
-
getBoolean
public static Boolean getBoolean(Collection<FHIRPathNode> nodes)
-
getDate
public static TemporalAccessor getDate(Collection<FHIRPathNode> nodes)
-
getDateTime
public static TemporalAccessor getDateTime(Collection<FHIRPathNode> nodes)
-
getTime
public static TemporalAccessor getTime(Collection<FHIRPathNode> nodes)
-
hasSystemValue
public static boolean hasSystemValue(Collection<FHIRPathNode> nodes)
-
getSystemValue
public static FHIRPathSystemValue getSystemValue(Collection<FHIRPathNode> nodes)
-
hasSystemValue
public static boolean hasSystemValue(FHIRPathNode node)
-
getSystemValue
public static FHIRPathSystemValue getSystemValue(FHIRPathNode node)
-
getStringValue
public static FHIRPathStringValue getStringValue(Collection<FHIRPathNode> nodes)
-
getQuantityValue
public static FHIRPathQuantityValue getQuantityValue(Collection<FHIRPathNode> nodes)
-
getIntegerValue
public static FHIRPathIntegerValue getIntegerValue(Collection<FHIRPathNode> nodes)
-
getDecimalValue
public static FHIRPathDecimalValue getDecimalValue(Collection<FHIRPathNode> nodes)
-
getNumberValue
public static FHIRPathNumberValue getNumberValue(Collection<FHIRPathNode> nodes)
-
getTemporalValue
public static FHIRPathTemporalValue getTemporalValue(Collection<FHIRPathNode> nodes)
-
getBooleanValue
public static FHIRPathBooleanValue getBooleanValue(Collection<FHIRPathNode> nodes)
-
hasBooleanValue
public static boolean hasBooleanValue(Collection<FHIRPathNode> nodes)
-
hasNumberValue
public static boolean hasNumberValue(Collection<FHIRPathNode> nodes)
-
hasDecimalValue
public static boolean hasDecimalValue(Collection<FHIRPathNode> nodes)
-
hasIntegerValue
public static boolean hasIntegerValue(Collection<FHIRPathNode> nodes)
-
hasTemporalValue
public static boolean hasTemporalValue(Collection<FHIRPathNode> nodes)
-
hasDateValue
public static boolean hasDateValue(Collection<FHIRPathNode> nodes)
-
getDateValue
public static FHIRPathDateValue getDateValue(Collection<FHIRPathNode> nodes)
-
hasDateTimeValue
public static boolean hasDateTimeValue(Collection<FHIRPathNode> nodes)
-
getDateTimeValue
public static FHIRPathDateTimeValue getDateTimeValue(Collection<FHIRPathNode> nodes)
-
hasTimeValue
public static boolean hasTimeValue(Collection<FHIRPathNode> nodes)
-
getTimeValue
public static FHIRPathTimeValue getTimeValue(Collection<FHIRPathNode> nodes)
-
hasStringValue
public static boolean hasStringValue(Collection<FHIRPathNode> nodes)
-
hasQuantityValue
public static boolean hasQuantityValue(Collection<FHIRPathNode> nodes)
-
evaluatesToBoolean
public static boolean evaluatesToBoolean(Collection<FHIRPathNode> nodes)
-
evaluatesToTrue
public static boolean evaluatesToTrue(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
-
isTrue
public static boolean isTrue(Collection<FHIRPathNode> nodes)
Indicates whetherconvertsToBoolean(java.util.Collection<com.ibm.fhir.path.FHIRPathNode>)
returns a true value for the input collection- Parameters:
nodes
- the input collection- Returns:
- true iff
convertsToBoolean(java.util.Collection<com.ibm.fhir.path.FHIRPathNode>)
returns a true value for the input collection, false otherwise
-
isFalse
public static boolean isFalse(Collection<FHIRPathNode> nodes)
Indicates whetherconvertsToBoolean(java.util.Collection<com.ibm.fhir.path.FHIRPathNode>)
returns a false value for the input collection- Parameters:
nodes
- the input collection- Returns:
- true iff
convertsToBoolean(java.util.Collection<com.ibm.fhir.path.FHIRPathNode>)
returns a false value for the input collection, false otherwise
-
convertsToBoolean
public static boolean convertsToBoolean(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(Collection<FHIRPathNode> nodes)
-
convertsToDate
public static boolean convertsToDate(Collection<FHIRPathNode> nodes)
-
toDate
public static FHIRPathDateValue toDate(Collection<FHIRPathNode> nodes)
-
convertsToDateTime
public static boolean convertsToDateTime(Collection<FHIRPathNode> nodes)
-
toDateTime
public static FHIRPathDateTimeValue toDateTime(Collection<FHIRPathNode> nodes)
-
convertsToTime
public static boolean convertsToTime(Collection<FHIRPathNode> nodes)
-
toTime
public static FHIRPathTimeValue toTime(Collection<FHIRPathNode> nodes)
-
isSingleton
public static boolean isSingleton(Collection<FHIRPathNode> nodes)
-
isSingleton
public static <T extends FHIRPathNode> boolean isSingleton(Collection<FHIRPathNode> nodes, Class<T> nodeType)
-
isSystemValue
public static boolean isSystemValue(Collection<FHIRPathNode> nodes)
-
isStringValue
public static boolean isStringValue(Collection<FHIRPathNode> nodes)
-
isBooleanValue
public static boolean isBooleanValue(Collection<FHIRPathNode> nodes)
-
isIntegerValue
public static boolean isIntegerValue(Collection<FHIRPathNode> nodes)
-
isDecimalValue
public static boolean isDecimalValue(Collection<FHIRPathNode> nodes)
-
getSingleton
public static FHIRPathNode getSingleton(Collection<FHIRPathNode> nodes)
- Throws:
IllegalArgumentException
- if the passed collection is not a singleton
-
getSingleton
public static <T extends FHIRPathNode> T getSingleton(Collection<FHIRPathNode> nodes, Class<T> nodeType)
-
singleton
public static Collection<FHIRPathNode> singleton(FHIRPathNode node)
-
empty
public static Collection<FHIRPathNode> empty()
-
getTemporalAccessor
public static TemporalAccessor getTemporalAccessor(Temporal temporal, Class<?> targetType)
-
getTemporal
public static Temporal getTemporal(TemporalAccessor temporalAccessor)
-
getTemporalAmount
public static TemporalAmount getTemporalAmount(FHIRPathQuantityValue quantityValue)
-
getChronoUnit
public static ChronoUnit getChronoUnit(String unit)
-
buildSimpleTypeInfo
public static SimpleTypeInfo buildSimpleTypeInfo(FHIRPathType type)
-
buildTupleTypeInfo
public static TupleTypeInfo buildTupleTypeInfo(Class<?> modelClass)
-
buildTupleTypeInfoElement
public static TupleTypeInfoElement buildTupleTypeInfoElement(ModelSupport.ElementInfo elementInfo)
-
buildClassInfo
public static ClassInfo buildClassInfo(FHIRPathType type)
-
buildClassInfoElement
public static ClassInfoElement buildClassInfoElement(ModelSupport.ElementInfo elementInfo)
-
unordered
public static Collection<FHIRPathNode> unordered(Collection<FHIRPathNode> nodes)
-
isOrdered
public static boolean isOrdered(Collection<FHIRPathNode> nodes)
-
isUnordered
public static boolean isUnordered(Collection<FHIRPathNode> nodes)
-
getPrecision
public static ChronoField getPrecision(TemporalAccessor temporalAccessor)
-
getPrecision
public static ChronoField getPrecision(TemporalAccessor temporalAccessor, String text)
-
hasTemporalValue
public static boolean hasTemporalValue(FHIRPathNode node)
-
getTemporalValue
public static FHIRPathTemporalValue getTemporalValue(FHIRPathNode node)
-
add
public static <T extends Visitable> T add(T elementOrResource, String fhirPath, 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
NullPointerException
- if any of the passed arguments are null
-
delete
public static <T extends Visitable> T delete(T elementOrResource, String fhirPath) throws FHIRPathException, FHIRPatchException
Only a single element can be deleted- Throws:
FHIRPathException
FHIRPatchException
NullPointerException
- if any of the passed arguments are null
-
replace
public static <T extends Visitable> T replace(T elementOrResource, String fhirPath, Visitable value) throws FHIRPathException, FHIRPatchException
- Parameters:
fhirPath
-value
-- Throws:
FHIRPathException
FHIRPatchException
NullPointerException
- if any of the passed arguments are null
-
insert
public static <T extends Visitable> T insert(T elementOrResource, 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
NullPointerException
- if any of the passed arguments are null
-
move
public static <T extends Visitable> T move(T elementOrResource, String fhirPath, int source, int target) throws FHIRPathException, FHIRPatchException
Move an element within a single list- Throws:
FHIRPathException
FHIRPatchException
NullPointerException
- if any of the passed arguments are null
-
-