/** * @deprecated Use {@link #toObject(Context, Scriptable, Object)} instead. */ public static Scriptable toObject(Context cx, Scriptable scope, Object val, Class<?> staticClass) { return toObject(cx, scope, val); }
/** * @deprecated * @see #toObject(Object, Scriptable) */ public static Scriptable toObject(Object value, Scriptable scope, Class<?> staticType) { return ScriptRuntime.toObject(scope, value); }
/** * @param scope the scope that should be used to resolve primitive prototype */ public static Scriptable toObjectOrNull(Context cx, Object obj, final Scriptable scope) { if (obj instanceof Scriptable) { return (Scriptable)obj; } else if (obj != null && obj != Undefined.instance) { return toObject(cx, scope, obj); } return null; }
/** * Convert the value to an JavaScript object value. * <p> * Note that a scope must be provided to look up the constructors * for Number, Boolean, and String. * <p> * See ECMA 9.9. * <p> * Additionally, arbitrary Java objects and classes will be * wrapped in a Scriptable object with its Java fields and methods * reflected as JavaScript properties of the object. * * @param value any Java object * @param scope global scope containing constructors for Number, * Boolean, and String * @return new JavaScript object */ public static Scriptable toObject(Object value, Scriptable scope) { return ScriptRuntime.toObject(scope, value); }
/** * Warning: this doesn't allow to resolve primitive prototype properly when many top scopes are involved */ public static Scriptable toObjectOrNull(Context cx, Object obj) { if (obj instanceof Scriptable) { return (Scriptable)obj; } else if (obj != null && obj != Undefined.instance) { return toObject(cx, getTopCallScope(cx), obj); } return null; }
public static Scriptable toObject(Scriptable scope, Object val) { if (val instanceof Scriptable) { return (Scriptable)val; } return toObject(Context.getContext(), scope, val); }
/** * @deprecated Use {@link #toObject(Scriptable, Object)} instead. */ public static Scriptable toObject(Scriptable scope, Object val, Class<?> staticClass) { if (val instanceof Scriptable) { return (Scriptable)val; } return toObject(Context.getContext(), scope, val); }
@Override public Object get(String name, Scriptable start) { if (this == thePrototypeInstance) return super.get(name, start); String result = System.getProperty(name); if (result != null) return ScriptRuntime.toObject(getParentScope(), result); else return Scriptable.NOT_FOUND; }
static Object newWithSpecial(Context cx, Scriptable scope, Object[] args) { ScriptRuntime.checkDeprecated(cx, "With"); scope = ScriptableObject.getTopLevelScope(scope); NativeWith thisObj = new NativeWith(); thisObj.setPrototype(args.length == 0 ? ScriptableObject.getClassPrototype(scope, "Object") : ScriptRuntime.toObject(cx, scope, args[0])); thisObj.setParentScope(scope); return thisObj; }
Scriptable obj = ScriptRuntime.toObject(cx, scope, args[N - 1]);
delegee = new NativeObject(); } else { delegee = ScriptRuntime.toObject(cx, scope, args[0]);
thisArg = ScriptRuntime.toObject(cx, scope, args[1]);
case ConstructorId_reduceRight: { if (args.length > 0) { thisObj = ScriptRuntime.toObject(scope, args[0]); Object[] newArgs = new Object[args.length-1]; for (int i=0; i < newArgs.length; i++)
ScriptRuntime.toString(args[0])); Scriptable obj = ScriptRuntime.toObject(scope, args[0]); boolean keyOnly = args.length > 1 && ScriptRuntime.toBoolean(args[1]); if (thisObj != null) {
return ScriptRuntime.toObject(cx, scope, args[0]);