public class FluentParserContext extends java.lang.Object implements ParserContext
Constructor and Description |
---|
FluentParserContext()
Create a new parser context, initially with all context attributes as null.
|
Modifier and Type | Method and Description |
---|---|
FluentParserContext |
evaluate(java.lang.Class contextType)
Configure the evaluationContextType attribute with the value provided.
|
FluentParserContext |
expectResult(java.lang.Class resultType)
Configure the expectedEvaluationResult attribute with the value provided.
|
java.lang.Class |
getEvaluationContextType()
Returns the type of context object the parsed expression will evaluate in.
|
java.lang.Class |
getExpectedEvaluationResultType()
Returns the expected type of object returned from evaluating the parsed expression.
|
ExpressionVariable[] |
getExpressionVariables()
Returns additional expression variables or aliases that can be referenced during expression evaluation.
|
boolean |
isTemplate()
Whether or not the expression being parsed is a template.
|
FluentParserContext |
template()
Sets a flag indicating the expression to parse is a template.
|
FluentParserContext |
variable(ExpressionVariable variable)
Add an expression variable that can be referenced by the expression.
|
FluentParserContext |
variables(ExpressionVariable[] variables)
Add an array of expression variables that can be referenced by the expression.
|
public FluentParserContext()
public java.lang.Class getEvaluationContextType()
ParserContext
getEvaluationContextType
in interface ParserContext
public java.lang.Class getExpectedEvaluationResultType()
ParserContext
getExpectedEvaluationResultType
in interface ParserContext
public ExpressionVariable[] getExpressionVariables()
ParserContext
getExpressionVariables
in interface ParserContext
public boolean isTemplate()
ParserContext
Some literal text Hello #{name.firstName}! #{3 + 4}
isTemplate
in interface ParserContext
public FluentParserContext evaluate(java.lang.Class contextType)
contextType
- the type of context object the parsed expression will evaluate inpublic FluentParserContext expectResult(java.lang.Class resultType)
resultType
- the type of result object the parsed expression should return when evaluatedpublic FluentParserContext variable(ExpressionVariable variable)
variable
- the expression variablepublic FluentParserContext variables(ExpressionVariable[] variables)
variables
- the expression variablespublic FluentParserContext template()