Package ch.andre601.expressionparser
Interface ExpressionParserEngine
- All Known Implementing Classes:
DefaultExpressionParserEngine
public interface ExpressionParserEngine
This interface can be used to create multiple Expression parsers, all using the same core stuff.
It is not required to use this at all.
It is not required to use this at all.
-
Nested Class Summary
Modifier and TypeInterfaceDescriptionstatic class
Abstract class that can be used to create a new Builder for aExpressionParserEngine
. -
Method Summary
Modifier and TypeMethodDescriptioncompile
(String text, ParseWarnCollector collector) Converts the provided String into aExpressionTemplate instance
to use.default boolean
compileToBoolean
(String text, ParseWarnCollector collector) Parses the provided text into aExpressionTemplate
and returns itsboolean
value to use.default boolean
compileToBoolean
(String text, ParseWarnCollector collector, boolean def) Parses the provided text into aExpressionTemplate
and returns itsboolean
value to use.default double
compileToDouble
(String text, ParseWarnCollector collector) Parses the provided text into aExpressionTemplate
and returns itsdouble
value to use.default double
compileToDouble
(String text, ParseWarnCollector collector, double def) Parses the provided text into aExpressionTemplate
and returns itsdouble
value to use.default String
compileToString
(String text, ParseWarnCollector collector) Parses the provided text into aExpressionTemplate
and returns itsString
value to use.default String
compileToString
(String text, ParseWarnCollector collector, String def) Parses the provided text into aExpressionTemplate
and returns itsString
value to use.
-
Method Details
-
compile
Converts the provided String into aExpressionTemplate instance
to use.- Parameters:
text
- The text to parse into a ExpressionTemplate.collector
-ParseWarnCollector instance
used to collect warnings during the parsing.- Returns:
- Possibly-null ExpressionTemplate instance.
-
compileToBoolean
Parses the provided text into aExpressionTemplate
and returns itsboolean
value to use.
Should the ExpressionTemplate be null willfalse
be used. UsecompileToBoolean(String, ParseWarnCollector, boolean)
to change the default boolean.- Parameters:
text
- The text to parse.collector
-ParseWarnCollector instance
used to collect warnings during the parsing.- Returns:
- boolean value from the parsed ExpressionTemplate.
-
compileToBoolean
Parses the provided text into aExpressionTemplate
and returns itsboolean
value to use.
Should the ExpressionTemplate be null will the provided default boolean value be used.- Parameters:
text
- The text to parse.collector
-ParseWarnCollector instance
used to collect warnings during the parsing.def
- Default boolean value to use should ExpressionTemplate returned be null.- Returns:
- boolean value from the parsed ExpressionTemplate.
-
compileToDouble
Parses the provided text into aExpressionTemplate
and returns itsdouble
value to use.
Should the ExpressionTemplate be null will0.0
be used. UsecompileToDouble(String, ParseWarnCollector, double)
to change the default double.- Parameters:
text
- The text to parse.collector
-ParseWarnCollector instance
used to collect warnings during the parsing.- Returns:
- double value from the parsed ExpressionTemplate.
-
compileToDouble
Parses the provided text into aExpressionTemplate
and returns itsdouble
value to use.
Should the ExpressionTemplate be null will the provided default double value be used.- Parameters:
text
- The text to parse.collector
-ParseWarnCollector instance
used to collect warnings during the parsing.def
- Default double value to use should ExpressionTemplate returned be null.- Returns:
- double value from the parsed ExpressionTemplate.
-
compileToString
Parses the provided text into aExpressionTemplate
and returns itsString
value to use.
Should the ExpressionTemplate be null will an empty String be used. UsecompileToString(String, ParseWarnCollector, String)
to change the default String.- Parameters:
text
- The text to parse.collector
-ParseWarnCollector instance
used to collect warnings during the parsing.- Returns:
- String value from the parsed ExpressionTemplate.
-
compileToString
Parses the provided text into aExpressionTemplate
and returns itsString
value to use.
Should the ExpressionTemplate be null will the provided default String value be used.- Parameters:
text
- The text to parse.collector
-ParseWarnCollector instance
used to collect warnings during the parsing.def
- Default String value to use should ExpressionTemplate returned be null.- Returns:
- String value from the parsed ExpressionTemplate.
-