Package org.openrefine.grel.ast
Class VariableExpr
- java.lang.Object
-
- org.openrefine.grel.ast.VariableExpr
-
- All Implemented Interfaces:
Serializable,GrelExpr
public class VariableExpr extends Object implements GrelExpr
An abstract syntax tree node encapsulating the retrieval of a variable's content.- See Also:
- Serialized Form
-
-
Constructor Summary
Constructors Constructor Description VariableExpr(String name)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description booleanequals(Object other)Objectevaluate(Properties bindings)Returns the value of the expression in a given context.Set<String>getColumnDependencies(String baseColumn)Returns the names of the columns this expression depends on.StringgetName()booleanisLocal()VariableExprrenameColumnDependencies(Map<String,String> substitutions)Translates this expression by simultaneously substituting column names as the supplied map specifies.StringtoString()For GREL expressions, toString should return the source code of the expression, or a source code for an equivalent expression.
-
-
-
Field Detail
-
_name
protected final String _name
-
-
Constructor Detail
-
VariableExpr
public VariableExpr(String name)
-
-
Method Detail
-
evaluate
public Object evaluate(Properties bindings)
Description copied from interface:GrelExprReturns the value of the expression in a given context.
-
toString
public String toString()
Description copied from interface:GrelExprFor GREL expressions, toString should return the source code of the expression, or a source code for an equivalent expression. (without the "grel:" prefix).
-
getName
public String getName()
-
getColumnDependencies
public Set<String> getColumnDependencies(String baseColumn)
Description copied from interface:GrelExprReturns the names of the columns this expression depends on.- Specified by:
getColumnDependenciesin interfaceGrelExpr- Parameters:
baseColumn- the name of the column this expression is based on (null if none)- Returns:
- null if the columns could not be isolated: in this case, the expression might depend on all columns in the project.
-
renameColumnDependencies
public VariableExpr renameColumnDependencies(Map<String,String> substitutions)
Description copied from interface:GrelExprTranslates this expression by simultaneously substituting column names as the supplied map specifies.This is only possible if the extraction of column dependencies with
GrelExpr.getColumnDependencies(String)succeeds (return a non-null value).- Specified by:
renameColumnDependenciesin interfaceGrelExpr- Parameters:
substitutions- a map specifying new names for some columns. If a column name is not present in the map, it is assumed that the column is not renamed.- Returns:
- a new expression with updated column names.
-
-