Package ch.andre601.expressionparser
Class DefaultExpressionParserEngine
java.lang.Object
ch.andre601.expressionparser.DefaultExpressionParserEngine
- All Implemented Interfaces:
ExpressionParserEngine
Class for a
ExpressionParserEngine
instance to use.
A static createDefault()
method is available to create a new instance of this class with
default values
applied for it to use.-
Nested Class Summary
Modifier and TypeClassDescriptionstatic class
Class extendingExpressionParserEngine.Builder
withDefaultExpressionParserEngine
.Nested classes/interfaces inherited from interface ch.andre601.expressionparser.ExpressionParserEngine
ExpressionParserEngine.Builder<T extends ExpressionParserEngine>
-
Constructor Summary
ConstructorDescriptionDefaultExpressionParserEngine
(List<TokenReader> tokenReaders, com.google.common.collect.ImmutableMap<Token, Operator> operators, com.google.common.collect.ImmutableList<ValueReader> valueReaders) Creates a new instance of this class. -
Method Summary
Modifier and TypeMethodDescriptioncompile
(String text, ParseWarnCollector collector) Parses the provided text into aExpressionTemplate
to use.Convenience method to create a new instance of this class with default values already applied.Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
Methods inherited from interface ch.andre601.expressionparser.ExpressionParserEngine
compileToBoolean, compileToBoolean, compileToDouble, compileToDouble, compileToString, compileToString
-
Constructor Details
-
DefaultExpressionParserEngine
public DefaultExpressionParserEngine(List<TokenReader> tokenReaders, com.google.common.collect.ImmutableMap<Token, Operator> operators, com.google.common.collect.ImmutableList<ValueReader> valueReaders) Creates a new instance of this class.
The providedTokenReader list
will be used to create a newExpressionTokenizer
while the provided Map ofTokens
andOperators
and the List ofValueReaders
will be used to create a newExpressionTemplateParser
.- Parameters:
tokenReaders
- List of TokenReaders to use.operators
- Immutable Map of Token-Operator pairs to use.valueReaders
- Immutable List of ValueReaders to use.
-
-
Method Details
-
createDefault
Convenience method to create a new instance of this class with default values already applied.
Calling this method is equal to callingnew DefaultBuilder().createDefault
followed byDefaultExpressionParserEngine.DefaultBuilder.build()
.- Returns:
- A new DefaultExpressionParserEngine with all values already applied.
-
compile
Parses the provided text into aExpressionTemplate
to use.- Specified by:
compile
in interfaceExpressionParserEngine
- Parameters:
text
- The text to parse into a ExpressionTemplate.collector
-ParseWarnCollector instance
used to collect warnings during the parsing.- Returns:
- New ExpressionTemplate to use.
-