Class LiteralExpression
- java.lang.Object
-
- org.apache.camel.language.simple.ast.BaseSimpleNode
-
- org.apache.camel.language.simple.ast.LiteralExpression
-
- All Implemented Interfaces:
LiteralNode
,SimpleNode
- Direct Known Subclasses:
SimpleFunctionExpression
public class LiteralExpression extends BaseSimpleNode implements LiteralNode
Represents literals in the AST.
-
-
Field Summary
Fields Modifier and Type Field Description protected StringBuilder
text
-
Fields inherited from class org.apache.camel.language.simple.ast.BaseSimpleNode
token
-
-
Constructor Summary
Constructors Constructor Description LiteralExpression(SimpleToken token)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description void
addText(String text)
Adds the given text to this model.String
createCode(String expression)
Creates Java code based on this model.org.apache.camel.Expression
createExpression(org.apache.camel.CamelContext camelContext, String expression)
Creates a CamelExpression
based on this model.String
getText()
Gets the textboolean
quoteEmbeddedNodes()
Whether to quote embedded nodes.String
toString()
-
Methods inherited from class org.apache.camel.language.simple.ast.BaseSimpleNode
getToken
-
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
-
Methods inherited from interface org.apache.camel.language.simple.ast.SimpleNode
getToken
-
-
-
-
Field Detail
-
text
protected final StringBuilder text
-
-
Constructor Detail
-
LiteralExpression
public LiteralExpression(SimpleToken token)
-
-
Method Detail
-
toString
public String toString()
- Overrides:
toString
in classBaseSimpleNode
-
addText
public void addText(String text)
Description copied from interface:LiteralNode
Adds the given text to this model. This operation can be invoked multiple times to add more text.- Specified by:
addText
in interfaceLiteralNode
- Parameters:
text
- the text to add
-
getText
public String getText()
Description copied from interface:LiteralNode
Gets the text- Specified by:
getText
in interfaceLiteralNode
- Returns:
- the text, will never be null, but may contain an empty string.
-
quoteEmbeddedNodes
public boolean quoteEmbeddedNodes()
Description copied from interface:LiteralNode
Whether to quote embedded nodes. Some functions such as the bean: function would need to quote its embedded nodes as they are parameter values for method names.- Specified by:
quoteEmbeddedNodes
in interfaceLiteralNode
-
createExpression
public org.apache.camel.Expression createExpression(org.apache.camel.CamelContext camelContext, String expression)
Description copied from interface:SimpleNode
Creates a CamelExpression
based on this model.- Specified by:
createExpression
in interfaceSimpleNode
- Parameters:
camelContext
- the camel contextexpression
- the input string- Returns:
- the created
Expression
-
createCode
public String createCode(String expression) throws SimpleParserException
Description copied from interface:SimpleNode
Creates Java code based on this model.- Specified by:
createCode
in interfaceSimpleNode
- Parameters:
expression
- the input string- Returns:
- the created Java code
- Throws:
SimpleParserException
- should be thrown if error parsing the model
-
-