If I have a simple java class like this:
public class MyClass() {
public String myMethod() {
return "MyValue";
}
public String myMethodWithParameter(final String parameter) {
return "MyValue" + parameter;
}
}
I could override the "myMethod()" class using this script:
var myClass = new MyClass() {
myMethod: function() { return "MyNewValue"; }
myMethodWithParameter: function(parameter) { return "MyNewValue" + parameter; }
}
In this example both the "myMethod" and the "myMethodWithParameter" are implemented now in the script instead of the java class.