T
- type of object that exists in parsed expressionspublic static final class ExpressionParser.Builder<T>
extends java.lang.Object
ExpressionParser<T>
instances.Constructor and Description |
---|
Builder(java.util.function.Function<java.lang.String,? extends T> objectObtainer)
Creates the
Builder . |
Modifier and Type | Method and Description |
---|---|
ExpressionParser.Builder<T> |
addBinaryOperator(java.lang.String text,
java.util.function.BinaryOperator<T> operator,
int priority)
Adds a binary operator to the builder.
|
ExpressionParser.Builder<T> |
addSpaceFunction(java.lang.String operator)
Adds a function for spaces.
|
ExpressionParser.Builder<T> |
addUnaryOperator(java.lang.String text,
java.util.function.UnaryOperator<T> operator,
int priority)
Adds a unary operator to the builder.
|
ExpressionParser<T> |
build() |
public Builder(java.util.function.Function<java.lang.String,? extends T> objectObtainer)
Builder
.objectObtainer
- a function that can turn strings into objects of the type handled by the parser.java.lang.NullPointerException
- if objectObtainer
is nullpublic ExpressionParser.Builder<T> addBinaryOperator(java.lang.String text, java.util.function.BinaryOperator<T> operator, int priority)
text
- text used to reference the operator, like '+'operator
- operator to addpriority
- operator's priority, which determines which operators are applied firstjava.lang.NullPointerException
- if text
or operator
is nullpublic ExpressionParser.Builder<T> addSpaceFunction(java.lang.String operator)
operator
- text of operator to usepublic ExpressionParser.Builder<T> addUnaryOperator(java.lang.String text, java.util.function.UnaryOperator<T> operator, int priority)
text
- text used to reference the operator, like '-'operator
- operator to addpriority
- operator's priority, which determines which operators are applied firstjava.lang.NullPointerException
- if text
or operator
is nullpublic ExpressionParser<T> build()
ExpressionParser<T>
instance with the properties given to this builder