android-components / mozilla.components.lib.jexl.evaluator / JexlContext / <init>

<init>

JexlContext(vararg pairs: Pair<String, JexlValue>)

Variables defined in the JexlContext are available to expressions.

Example context:

val context = JexlContext( “employees” to JexlArray( JexlObject( “first” to “Sterling”.toJexl(), “last” to “Archer”.toJexl(), “age” to 36.toJexl()), JexlObject( “first” to “Malory”.toJexl(), “last” to “Archer”.toJexl(), “age” to 75.toJexl()), JexlObject( “first” to “Malory”.toJexl(), “last” to “Archer”.toJexl(), “age” to 33.toJexl()) ) )

This context can be accessed in an JEXL expression like this: