Package org.evrete.api
Interface ExpressionResolver
public interface ExpressionResolver
An interface with a set of basic methods that are necessary for parsing string expressions.
-
Method Summary
Modifier and TypeMethodDescriptiondefault EvaluatorbuildExpression(String expression, NamedType.Resolver resolver) Deprecated.default LiteralEvaluatorbuildExpression(LiteralExpression expression) This method parses a string argument and returns anEvaluatorif possible.buildExpressions(Collection<LiteralExpression> expressions) This method builds literal expressions all at once and returns a collection of compiled results.resolve(String arg, NamedType.Resolver resolver) This method takes a string as an argument and builds aFieldReferenceif possible.default FieldReference[]resolve(NamedType.Resolver resolver, String... strings)
-
Method Details
-
resolve
This method takes a string as an argument and builds a
FieldReferenceif possible.For example, if the argument is "$c.category.id", the implementation might do the following:
- Parameters:
arg- a String to parseresolver- a mapping function between fact name and fullNamedType- Returns:
- returns
FieldReferenceinstance or throws anIllegalArgumentException - Throws:
IllegalArgumentException- if the argument can not be resolved
-
resolve
-
buildExpression
@Deprecated default Evaluator buildExpression(String expression, NamedType.Resolver resolver) throws org.evrete.runtime.compiler.CompilationException Deprecated.usebuildExpression(LiteralExpression)instead- Throws:
org.evrete.runtime.compiler.CompilationException
-
buildExpression
default LiteralEvaluator buildExpression(LiteralExpression expression) throws org.evrete.runtime.compiler.CompilationException This method parses a string argument and returns an
Evaluatorif possible.- Parameters:
expression- - literal expression and its context- Returns:
- returns an
Evaluatorinstance or throws an exception - Throws:
org.evrete.runtime.compiler.CompilationException- if the argument can not be compiledIllegalArgumentException- if the expression can not be resolvedIllegalStateException- if the resolver is not in an appropriate state
-
buildExpressions
Collection<LiteralEvaluator> buildExpressions(Collection<LiteralExpression> expressions) throws org.evrete.runtime.compiler.CompilationException This method builds literal expressions all at once and returns a collection of compiled results. Order is not guaranteed, use the
LiteralEvaluator.getSource()method to associate the resulting evaluators with the method's argument list.- Parameters:
expressions- - literal expressions- Returns:
- collection of
LiteralEvaluatorinstances - Throws:
org.evrete.runtime.compiler.CompilationException- if the argument can not be compiledIllegalArgumentException- if the expression can not be resolved
-
buildExpression(LiteralExpression)instead