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 ArgumentsNode
args
private Expression<?>
attributeNameExpression
private java.lang.String
filename
private int
lineNumber
private 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 void
accept(NodeVisitor visitor)
java.lang.Object
evaluate(PebbleTemplateImpl self, EvaluationContextImpl context)
ArgumentsNode
getArgumentsNode()
private java.lang.Object[]
getArgumentValues(PebbleTemplateImpl self, EvaluationContextImpl context)
Fully evaluates the individual arguments.Expression<?>
getAttributeNameExpression()
int
getLineNumber()
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:
evaluate
in 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:Expression
Returns the line number on which the expression is defined on.- Specified by:
getLineNumber
in interfaceExpression<java.lang.Object>
- Returns:
- the line number on which the expression is defined on.
-
-