/** * Returns a clone of this data context with {@link #hasOwnProperties} set to {@code false}. * * @return a new cloned data context. */ public DataContext copy() { return new DataContext(this); }
/** * Utility method to create a new {@link DataContext} without any {@link #scope}. * * @param context The proteus context to resolve {@link FunctionBinding} to evaluate the scope. * @param data The data to be used by the data context. * @param dataIndex The data index to used by the data context. * @return A new data context with scope evaluated. */ public static DataContext create(@NonNull ProteusContext context, @Nullable ObjectValue data, int dataIndex) { DataContext dataContext = new DataContext(null, dataIndex); dataContext.update(context, data); return dataContext; }
/** * Utility method to create a new {@link DataContext} with a {@link #scope}. * * @param context The proteus android context to resolve {@link FunctionBinding} to evaluate the scope. * @param data The data to be used by the data context. * @param dataIndex The data index to used by the data context. * @param scope The scope map used to create the {@link #data} of this data context. * @return A new data context with scope evaluated. */ public static DataContext create(@NonNull ProteusContext context, @Nullable ObjectValue data, int dataIndex, @Nullable Map<String, Value> scope) { DataContext dataContext = new DataContext(scope, dataIndex); dataContext.update(context, data); return dataContext; }