Call hasFunction() on the prototype rather than on HopObjects themselves to avoid fetching
references or child objects from database.
This commit is contained in:
parent
fad97efc60
commit
512cea20ac
1 changed files with 7 additions and 1 deletions
|
@ -337,7 +337,13 @@ public class RhinoEngine implements ScriptingEngine {
|
||||||
* is a java object) with that name.
|
* is a java object) with that name.
|
||||||
*/
|
*/
|
||||||
public boolean hasFunction(Object obj, String fname) {
|
public boolean hasFunction(Object obj, String fname) {
|
||||||
// System.err.println ("HAS_FUNC: "+obj+"."+fname);
|
// Treat HopObjects separately - otherwise we risk to fetch database
|
||||||
|
// references/child objects just to check for function properties.
|
||||||
|
if (obj instanceof INode) {
|
||||||
|
String protoname = ((INode) obj).getPrototype();
|
||||||
|
return core.hasFunction(protoname, fname.replace('.', '_'));
|
||||||
|
}
|
||||||
|
|
||||||
Scriptable op = obj == null ? global : Context.toObject(obj, global);
|
Scriptable op = obj == null ? global : Context.toObject(obj, global);
|
||||||
|
|
||||||
Object func = ScriptableObject.getProperty(op, fname.replace('.', '_'));
|
Object func = ScriptableObject.getProperty(op, fname.replace('.', '_'));
|
||||||
|
|
Loading…
Add table
Reference in a new issue