Package org.openrefine.expr
Class ExpressionUtils
- java.lang.Object
-
- org.openrefine.expr.ExpressionUtils
-
public class ExpressionUtils extends Object
-
-
Constructor Summary
Constructors Constructor Description ExpressionUtils()
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static void
bind(Properties bindings, ColumnModel columnModel, Row row, long rowIndex, Record record, String columnName, Cell cell, Map<String,OverlayModel> overlayModels, long projectId)
Prepares the context for the evaluation of an expression by storing certain context objects within the supplied bindings.static Properties
createBindings()
static boolean
dependsOnPendingValues(Evaluable evaluable, String baseColumnName, ColumnModel columnModel, Row row, Record record)
Checks if the given expression relies on any pending cells in the given evaluation context.static boolean
isArray(Object v)
static boolean
isArrayOrCollection(Object v)
static boolean
isArrayOrList(Object v)
static boolean
isError(Object o)
static boolean
isNonBlankData(Object o)
static boolean
isStorable(Object v)
static boolean
isTrue(Object o)
static void
registerBinder(Binder binder)
static boolean
sameValue(Object v1, Object v2)
static Collection<Object>
toObjectCollection(Object v)
static List<Object>
toObjectList(Object v)
static Serializable
wrapStorable(Object v)
-
-
-
Method Detail
-
registerBinder
public static void registerBinder(Binder binder)
-
createBindings
public static Properties createBindings()
-
bind
public static void bind(Properties bindings, ColumnModel columnModel, Row row, long rowIndex, Record record, String columnName, Cell cell, Map<String,OverlayModel> overlayModels, long projectId)
Prepares the context for the evaluation of an expression by storing certain context objects within the supplied bindings.- Parameters:
bindings
- the dictionary representing the variables available in the expression's contextcolumnModel
- the list of column metadata for the project being currently evaluatedrow
- the row on which the expression is evaluatedrowIndex
- the index of the row on which the expression is evaluatedrecord
- the enclosing record, if available (only in records mode)columnName
- the name of the base column for the expressioncell
- the cell at the intersection of the base column and current rowoverlayModels
- the overlay models stored in the grid on which the expression is evaluatedprojectId
- the id of the project this expression is evaluated on
-
dependsOnPendingValues
public static boolean dependsOnPendingValues(Evaluable evaluable, String baseColumnName, ColumnModel columnModel, Row row, Record record)
Checks if the given expression relies on any pending cells in the given evaluation context. If so, the result of its evaluation should be considered pending as well. This is meant to be an over-approximation: this method might return true even if the expression can actually be evaluated without relying on any pending cells. This happens for instance if the evaluable does not expose column dependencies and the evaluation context contains any pending cell.- Parameters:
evaluable
- the evaluable to evaluate
-
isError
public static boolean isError(Object o)
-
isNonBlankData
public static boolean isNonBlankData(Object o)
-
isTrue
public static boolean isTrue(Object o)
-
isStorable
public static boolean isStorable(Object v)
-
wrapStorable
public static Serializable wrapStorable(Object v)
-
isArray
public static boolean isArray(Object v)
-
isArrayOrCollection
public static boolean isArrayOrCollection(Object v)
-
isArrayOrList
public static boolean isArrayOrList(Object v)
-
toObjectCollection
public static Collection<Object> toObjectCollection(Object v)
-
-