Class FieldAccessorExpr

  • All Implemented Interfaces:
    Serializable, GrelExpr

    public class FieldAccessorExpr
    extends Object
    implements GrelExpr
    An abstract syntax tree node encapsulating a field accessor, e.g., "cell.value" is accessing the field named "value" on the variable called "cell".
    See Also:
    Serialized Form
    • Field Detail

      • _inner

        protected final GrelExpr _inner
      • _fieldName

        protected final String _fieldName
    • Constructor Detail

      • FieldAccessorExpr

        public FieldAccessorExpr​(GrelExpr inner,
                                 String fieldName)
    • Method Detail

      • evaluate

        public Object evaluate​(Properties bindings)
        Description copied from interface: GrelExpr
        Returns the value of the expression in a given context.
        Specified by:
        evaluate in interface GrelExpr
        Parameters:
        bindings - the evaluation context, mapping variable names to their values
        Returns:
        the result of the evaluation of the expression
      • toString

        public String toString()
        Description copied from interface: GrelExpr
        For GREL expressions, toString should return the source code of the expression, or a source code for an equivalent expression. (without the "grel:" prefix).
        Specified by:
        toString in interface GrelExpr
        Overrides:
        toString in class Object
      • getColumnDependencies

        public Set<String> getColumnDependencies​(String baseColumn)
        Description copied from interface: GrelExpr
        Returns the names of the columns this expression depends on.
        Specified by:
        getColumnDependencies in interface GrelExpr
        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 FieldAccessorExpr renameColumnDependencies​(Map<String,​String> substitutions)
        Description copied from interface: GrelExpr
        Translates 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:
        renameColumnDependencies in interface GrelExpr
        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.
      • isLocal

        public boolean isLocal()
        Specified by:
        isLocal in interface GrelExpr
        Returns:
        true when the expression can be evaluated purely based on the local context (see Evaluable).