* Make overloaded methods (href, renderskin, ...) overridable in JavaScript.
This commit is contained in:
parent
d818de0d0a
commit
21117936ad
1 changed files with 7 additions and 4 deletions
|
@ -182,10 +182,7 @@ public class JavaObject extends NativeJavaObject {
|
||||||
*/
|
*/
|
||||||
public Object get(String name, Scriptable start) {
|
public Object get(String name, Scriptable start) {
|
||||||
// System.err.println ("GET: "+name);
|
// System.err.println ("GET: "+name);
|
||||||
Object obj = overload.get(name);
|
Object obj;
|
||||||
if (obj != null) {
|
|
||||||
return new FunctionObject(name, (Method) obj, this);
|
|
||||||
}
|
|
||||||
|
|
||||||
// we really are not supposed to walk down the prototype chain in get(),
|
// we really are not supposed to walk down the prototype chain in get(),
|
||||||
// but we break the rule in order to be able to override java methods,
|
// but we break the rule in order to be able to override java methods,
|
||||||
|
@ -199,6 +196,11 @@ public class JavaObject extends NativeJavaObject {
|
||||||
proto = proto.getPrototype();
|
proto = proto.getPrototype();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
obj = overload.get(name);
|
||||||
|
if (obj != null) {
|
||||||
|
return new FunctionObject(name, (Method) obj, this);
|
||||||
|
}
|
||||||
|
|
||||||
if ("_prototype".equals(name) || "__prototype__".equals(name)) {
|
if ("_prototype".equals(name) || "__prototype__".equals(name)) {
|
||||||
return protoName;
|
return protoName;
|
||||||
}
|
}
|
||||||
|
@ -213,6 +215,7 @@ public class JavaObject extends NativeJavaObject {
|
||||||
|
|
||||||
return super.get(name, start);
|
return super.get(name, start);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Returns a prototype's resource of a given name. Walks up the prototype's
|
* Returns a prototype's resource of a given name. Walks up the prototype's
|
||||||
* inheritance chain if the resource is not found
|
* inheritance chain if the resource is not found
|
||||||
|
|
Loading…
Add table
Reference in a new issue