Class FHIRPathEvaluator
- java.lang.Object
-
- org.linuxforhealth.fhir.path.evaluator.FHIRPathEvaluator
-
@NotThreadSafe public class FHIRPathEvaluator extends java.lang.Object
A FHIRPath evaluation engine that implements the FHIRPath 2.0.0 specification
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static class
FHIRPathEvaluator.EvaluatingVisitor
static class
FHIRPathEvaluator.EvaluationContext
A context object used to pass information to/from the FHIRPath evaluation enginestatic interface
FHIRPathEvaluator.EvaluationListener
A listener interface for receiving notifications during evaluation
-
Field Summary
Fields Modifier and Type Field Description static java.util.Collection<FHIRPathNode>
SINGLETON_FALSE
static java.util.Collection<FHIRPathNode>
SINGLETON_TRUE
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description java.util.Collection<FHIRPathNode>
evaluate(java.lang.String expr)
Evaluate a FHIRPath expressionjava.util.Collection<FHIRPathNode>
evaluate(Resource resource, java.lang.String expr)
Evaluate a FHIRPath expression against aResource
java.util.Collection<FHIRPathNode>
evaluate(Element element, java.lang.String expr)
Evaluate a FHIRPath expression against anElement
java.util.Collection<FHIRPathNode>
evaluate(Visitable resourceOrElement, java.lang.String expr)
java.util.Collection<FHIRPathNode>
evaluate(FHIRPathEvaluator.EvaluationContext evaluationContext, java.lang.String expr)
Evaluate a FHIRPath expression using an existing evaluation contextjava.util.Collection<FHIRPathNode>
evaluate(FHIRPathEvaluator.EvaluationContext evaluationContext, java.lang.String expr, java.util.Collection<FHIRPathNode> initialContext)
Evaluate a FHIRPathExpression using an existing EvaluationContext against a collection of FHIRPath nodesjava.util.Collection<FHIRPathNode>
evaluate(FHIRPathEvaluator.EvaluationContext evaluationContext, java.lang.String expr, FHIRPathNode node)
Evaluate a FHIRPath expression using an existing evaluation context against a FHIRPath nodestatic FHIRPathEvaluator
evaluator()
Static factory method for creating FHIRPathEvaluator instancesFHIRPathEvaluator.EvaluationContext
getEvaluationContext()
Get the EvaluationContext associated with this FHIRPathEvaluator
-
-
-
Field Detail
-
SINGLETON_TRUE
public static final java.util.Collection<FHIRPathNode> SINGLETON_TRUE
-
SINGLETON_FALSE
public static final java.util.Collection<FHIRPathNode> SINGLETON_FALSE
-
-
Method Detail
-
getEvaluationContext
public FHIRPathEvaluator.EvaluationContext getEvaluationContext()
Get the EvaluationContext associated with this FHIRPathEvaluator- Returns:
- get the EvaluationContext associated with this FHIRPathEvaluator
-
evaluate
public java.util.Collection<FHIRPathNode> evaluate(java.lang.String expr) throws FHIRPathException
Evaluate a FHIRPath expression- Parameters:
expr
- the FHIRPath expression to evaluate- Returns:
- the result of evaluation as a non-null, potentially empty collection of FHIRPath nodes
- Throws:
java.lang.NullPointerException
- if any of the parameters are nullFHIRPathException
- if an exception occurs during evaluation
-
evaluate
public java.util.Collection<FHIRPathNode> evaluate(Visitable resourceOrElement, java.lang.String expr) throws FHIRPathException
- Parameters:
resourceOrElement
- theResource
orElement
expr
- the FHIRPath expression to evaluate- Returns:
- the result of evaluation as a non-null, potentially empty collection of FHIRPath nodes
- Throws:
java.lang.NullPointerException
- if any of the parameters are nullFHIRPathException
- if an exception occurs during evaluation
-
evaluate
public java.util.Collection<FHIRPathNode> evaluate(Resource resource, java.lang.String expr) throws FHIRPathException
Evaluate a FHIRPath expression against aResource
- Parameters:
resource
- the resourceexpr
- the FHIRPath expression to evaluate- Returns:
- the result of evaluation as a non-null, potentially empty collection of FHIRPath nodes
- Throws:
java.lang.NullPointerException
- if any of the parameters are nullFHIRPathException
- if an exception occurs during evaluation
-
evaluate
public java.util.Collection<FHIRPathNode> evaluate(Element element, java.lang.String expr) throws FHIRPathException
Evaluate a FHIRPath expression against anElement
- Parameters:
element
- the elementexpr
- the FHIRPath expression to evaluate- Returns:
- the result of evaluation as a non-null, potentially empty collection of FHIRPath nodes
- Throws:
java.lang.NullPointerException
- if any of the parameters are nullFHIRPathException
- if an exception occurs during evaluation
-
evaluate
public java.util.Collection<FHIRPathNode> evaluate(FHIRPathEvaluator.EvaluationContext evaluationContext, java.lang.String expr) throws FHIRPathException
Evaluate a FHIRPath expression using an existing evaluation context- Parameters:
evaluationContext
- the evaluation contextexpr
- the FHIRPath expression to evaluate- Returns:
- the result of evaluation as a non-null, potentially empty collection of FHIRPath nodes
- Throws:
java.lang.NullPointerException
- if any of the parameters are nullFHIRPathException
- if an exception occurs during evaluation
-
evaluate
public java.util.Collection<FHIRPathNode> evaluate(FHIRPathEvaluator.EvaluationContext evaluationContext, java.lang.String expr, FHIRPathNode node) throws FHIRPathException
Evaluate a FHIRPath expression using an existing evaluation context against a FHIRPath node- Parameters:
evaluationContext
- the evaluation contextexpr
- the FHIRPath expression to evaluatenode
- the FHIRPath node- Returns:
- the result of evaluation as a non-null, potentially empty collection of FHIRPath nodes
- Throws:
java.lang.NullPointerException
- if any of the parameters are nullFHIRPathException
- if an exception occurs during evaluation
-
evaluate
public java.util.Collection<FHIRPathNode> evaluate(FHIRPathEvaluator.EvaluationContext evaluationContext, java.lang.String expr, java.util.Collection<FHIRPathNode> initialContext) throws FHIRPathException
Evaluate a FHIRPathExpression using an existing EvaluationContext against a collection of FHIRPath nodes- Parameters:
evaluationContext
- the evaluation contextexpr
- the FHIRPath expression to evaluateinitialContext
- the initial context as a non-null, potentially empty collection of FHIRPath nodes- Returns:
- the result of evaluation as a collection of FHIRPath nodes
- Throws:
java.lang.NullPointerException
- if any of the parameters are nullFHIRPathException
- if an exception occurs during evaluation
-
evaluator
public static FHIRPathEvaluator evaluator()
Static factory method for creating FHIRPathEvaluator instances- Returns:
- a new FHIRPathEvaluator instance
-
-