Package org.qubership.atp.dataset.macros
Interface EvaluationContext
- All Known Implementing Classes:
EvalContextImpl
public interface EvaluationContext
-
Method Summary
Modifier and TypeMethodDescriptionEvaluates text using this context.Evaluates parameter using this context.evaluate(OverlapItem.Reachable source, Parameter target, String value) Finds context to evaluate parameter in.<O> OexecuteInAnyContext(Iterator<? extends EvaluationContext> of, MacroContext.ContextedTask<O> toExecute) ExecutesMacroContext.ContextedTaskin a context chain.getDs()getDsl()Iterator<? extends EvaluationContext> May be empty.default EvaluationContextgetRoot()Returns root context of a context chain.Iterator<? extends EvaluationContext> May not be empty.relativizePathFromSharedToThis(EvaluationContext shared, List<RefArg<Attribute>> attrArgs) When you are searching for params in shared context by using refs, defined in this context, you should relativize attribute path like if param was defined in shared context.voidresolveArguments(List<? extends RefArg<?>> args)
-
Method Details
-
getParent
-
getDsl
-
getDs
-
getRoot
Returns root context of a context chain. -
executeInAnyContext
@Nonnull <O> O executeInAnyContext(@Nonnull Iterator<? extends EvaluationContext> of, @Nonnull MacroContext.ContextedTask<O> toExecute) throws CtxEvalException ExecutesMacroContext.ContextedTaskin a context chain. Starting context is the provided one (current). Going upper through callers contexts if the task failed with an exception. Returns first valid task result.- Parameters:
of- typically isgetStrictContexts().- Throws:
CtxEvalException- if args are not resolved or task failed with an exception in all possible contexts.
-
resolveArguments
- Throws:
Exception
-
evaluate
@Nonnull String evaluate(@Nonnull OverlapItem.Reachable source, @Nonnull Parameter target, @Nonnull String value) throws CtxEvalException Finds context to evaluate parameter in. Evaluates parameter using found context.- Parameters:
target- issource.getParameter().get(). Ensure that it exists first.value- issource.getParameter().get().getValue().get(). Ensure that it exists first.- Throws:
IllegalArgumentException- ifvalueis empty.CtxEvalException
-
evaluate
@Nonnull String evaluate(@Nonnull Parameter parameter, @Nonnull String value) throws CtxEvalException Evaluates parameter using this context. Useevaluate(OverlapItem.Reachable, Parameter, String)when possible!- Parameters:
parameter- to evaluate.value- isparameter.getValue().get(). Ensure that it is exists first.- Throws:
IllegalArgumentException- ifvalueis empty.CtxEvalException
-
evaluate
Evaluates text using this context. Useevaluate(Parameter, String)when possible!- Parameters:
inputText- text to evaluate.- Throws:
IllegalArgumentException- ifvalueis empty.CtxEvalException
-
getStrictContexts
Iterator<? extends EvaluationContext> getStrictContexts()May not be empty. Returned contexts are relative andrelativizePathFromSharedToThis(EvaluationContext, List)should be used for each of them.- Returns:
- callers plus this.
-
getNonStrictContexts
Iterator<? extends EvaluationContext> getNonStrictContexts()May be empty. Returned contexts are not relative andrelativizePathFromSharedToThis(EvaluationContext, List)should not be used for each of them. Used when no one string context fits to your needs.- Returns:
- additional contexts.
-