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 Type Method Description EvaluatorbuildExpression(String stringExpression, NamedType.Resolver resolver, Set<String> imports)This method parses a string argument and returns anEvaluatorif possible.FieldReferenceresolve(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 names and their fullNamedType- Returns:
- returns
FieldReferenceinstance or throws anIllegalArgumentException - Throws:
IllegalArgumentException- if the argument can not be resolved
-
resolve
-
buildExpression
Evaluator buildExpression(String stringExpression, NamedType.Resolver resolver, Set<String> imports) throws CompilationExceptionThis method parses a string argument and returns an
Evaluatorif possible.- Parameters:
stringExpression- - an String condition expression to parseresolver- a mapping function between fact names and their fullNamedTypeimports- a collection of class imports- Returns:
- returns an
Evaluatorinstance or throws an exception - Throws:
CompilationException- if the argument can not be compiledIllegalArgumentException- if the any parts of the argument can not be resolved- See Also:
resolve(String, NamedType.Resolver)
-