Class GetAttributeExpression
- java.lang.Object
-
- io.pebbletemplates.pebble.node.expression.GetAttributeExpression
-
- All Implemented Interfaces:
Expression<java.lang.Object>,Node
public class GetAttributeExpression extends java.lang.Object implements Expression<java.lang.Object>
Used to get an attribute from an object. It will look up attributes in the following order: map entry, array item, list item, get method, is method, has method, public method, public field.
-
-
Field Summary
Fields Modifier and Type Field Description private ArgumentsNodeargsprivate Expression<?>attributeNameExpressionprivate java.lang.Stringfilenameprivate intlineNumberprivate Expression<?>node
-
Constructor Summary
Constructors Constructor Description GetAttributeExpression(Expression<?> node, Expression<?> attributeNameExpression, ArgumentsNode args, java.lang.String filename, int lineNumber)GetAttributeExpression(Expression<?> node, Expression<?> attributeNameExpression, java.lang.String filename, int lineNumber)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description voidaccept(NodeVisitor visitor)java.lang.Objectevaluate(PebbleTemplateImpl self, EvaluationContextImpl context)ArgumentsNodegetArgumentsNode()private java.lang.Object[]getArgumentValues(PebbleTemplateImpl self, EvaluationContextImpl context)Fully evaluates the individual arguments.Expression<?>getAttributeNameExpression()intgetLineNumber()Returns the line number on which the expression is defined on.Expression<?>getNode()
-
-
-
Field Detail
-
node
private final Expression<?> node
-
attributeNameExpression
private final Expression<?> attributeNameExpression
-
args
private final ArgumentsNode args
-
filename
private final java.lang.String filename
-
lineNumber
private final int lineNumber
-
-
Constructor Detail
-
GetAttributeExpression
public GetAttributeExpression(Expression<?> node, Expression<?> attributeNameExpression, java.lang.String filename, int lineNumber)
-
GetAttributeExpression
public GetAttributeExpression(Expression<?> node, Expression<?> attributeNameExpression, ArgumentsNode args, java.lang.String filename, int lineNumber)
-
-
Method Detail
-
evaluate
public java.lang.Object evaluate(PebbleTemplateImpl self, EvaluationContextImpl context) throws PebbleException
- Specified by:
evaluatein interfaceExpression<java.lang.Object>- Throws:
PebbleException
-
getArgumentValues
private java.lang.Object[] getArgumentValues(PebbleTemplateImpl self, EvaluationContextImpl context)
Fully evaluates the individual arguments.
-
accept
public void accept(NodeVisitor visitor)
-
getNode
public Expression<?> getNode()
-
getAttributeNameExpression
public Expression<?> getAttributeNameExpression()
-
getArgumentsNode
public ArgumentsNode getArgumentsNode()
-
getLineNumber
public int getLineNumber()
Description copied from interface:ExpressionReturns the line number on which the expression is defined on.- Specified by:
getLineNumberin interfaceExpression<java.lang.Object>- Returns:
- the line number on which the expression is defined on.
-
-