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 TypeMethodDescriptionbuildExpression(String stringExpression, NamedType.Resolver resolver, Set<String> imports) This method parses a string argument and returns anEvaluatorif possible.default EvaluatorbuildExpression(String stringExpression, NamedType.Resolver resolver, Set<String> imports, ClassLoader classLoader, Properties properties) This method parses a string argument and returns anEvaluatorif possible.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
Evaluator buildExpression(String stringExpression, NamedType.Resolver resolver, Set<String> imports) throws CompilationException This method parses a string argument and returns an
Evaluatorif possible.- Parameters:
stringExpression- - a String condition expression to parseresolver- a mapping function between fact name andNamedTypeimports- 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:
-
buildExpression
default Evaluator buildExpression(String stringExpression, NamedType.Resolver resolver, Set<String> imports, ClassLoader classLoader, Properties properties) throws CompilationException This method parses a string argument and returns an
Evaluatorif possible.Introduced in 2.1.06, this method will replace the
buildExpression(String, NamedType.Resolver, Set)method which will be deprecated in future releases.- Parameters:
stringExpression- - a String condition expression to parseresolver- a mapping function between fact name andNamedTypeimports- a collection of class importsproperties- optional properties for the parser/compiler- 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- Since:
- 2.1.06
- See Also:
-