Take a look to this example from the tests which I think could help you:
public static class Child {
private String name;
public Child(String cname) { name = cname; }
public String getName1() { return name; }
public String getName2(long l) { return name + l; }
public String getName3(Child c) { return c==null? "NULL" :c.getName1(); }
public String wrapped_method(long l) {return "" + l;}
}
public static class Mother {
Child child;
public void setChild(Child c) {child = c;}
public Child getChild() {return child;}
}
@ExportPackage("ex")
@Export("Child")
public static class XChild implements ExportOverlay<Child>{
public XChild(String s){}
@Export("name")
public String getName1() {return null;}
@Export("name")
public String getName2(long l) {return null;}
@Export("name")
public String getName3(Child c) {return null;}
@ExportConstructor
public static Child constructor(String name, String surname) {
return new Child(name + " " + surname);
}
@ExportInstanceMethod("foo")
public static String instanceMethod(Child instance, String name,
String surname, long l) {
return name + "-" + surname + "-Foo-" + l;
}
@ExportInstanceMethod("foo")
public static String instanceMethod(Child instance, String name) {
return name + "-Caa";
}
public String wrapped_method(long l) {return null;}
}
@ExportPackage("ex")
@Export("Mother")
public static class XMother implements ExportOverlay<Mother>{
public void setChild(Child c) {}
public Child getChild() {return null;}
}
var child = new $wnd.ex.Child("Bill");
var mother = new $wnd.ex.Mother();
mother.setChild(child);
p("Bill", mother.getChild().name());
p("Bill2", mother.getChild().name(2));
p("Joe", child.name(new $wnd.ex.Child("Joe")));
p("s1-s2-Foo-2", child.foo('s1', 's2', 2));
p("s1-Caa", child.foo('s1'));
p("null-Caa", child.foo(null));
- Manolo