Here you can find the source of stringValue(String name, Scriptable scope)
Parameter | Description |
---|---|
name | the JavaScript variable. |
scope | the JavaScript scope to read from |
static String stringValue(String name, Scriptable scope)
//package com.java2s; //License from project: Open Source License import org.mozilla.javascript.Scriptable; public class Main { /**//from w ww . j a v a 2 s .c o m * Returns the value of a JavaScript variable, or null. * @param name the JavaScript variable. * @param scope the JavaScript scope to read from * @return the value of <i>name</i> or null. */ static String stringValue(String name, Scriptable scope) { if (scope == null) { return null; } Object o = scope.get(name, scope); return o instanceof String ? (String) o : null; } }