Here you can find the source of getProperty(Scriptable obj, final String prop)
public static Object getProperty(Scriptable obj, final String prop) throws NoSuchFieldException
//package com.java2s; //License from project: LGPL import org.mozilla.javascript.Scriptable; public class Main { public static Object getProperty(Scriptable obj, final String prop) throws NoSuchFieldException { while (obj != null) { final Object val = obj.get(prop, obj); if (val != Scriptable.NOT_FOUND) { return val; }/* w ww . j av a 2s. c om*/ obj = obj.getPrototype(); } throw new NoSuchFieldException(prop); } }