You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Hi, I just found out this library and jOOR. I really like your projects. I'd like it better if you guys could achieve "subclassing" interfaces and/or abstract classes using lambdas. This would be very helpful for using Java as an interpreted language.
Expected behavior and actual behavior:
I don't know whether similar functionalities exist. But this is what I expect:
// Run this code in a jupyter notebook.interfaceCounter {
// This is an interface, but it can also be an abstract classvoidadd();
voidshow();
}
org.joor.ReflectmyClass = lambdaSubclass(on(Counter))
.addField("counter", Integer.class)
.setDefaultConstructor(self -> self.set("counter", 0))
.set("add", self -> self.set("counter", self.get("counter") +1)),
"show", self -> System.out.println(self.get("counter"))) // "set" is a function of variable length.
.doneSubclass();
Counter x = myClass.create();
x.add();
x.show();
x.add();
x.show();
// Should print 1 then print 2.
Is this possible or already implemented? If not, can I request this functionality and/or help implement it? Thank you!
The text was updated successfully, but these errors were encountered:
Hi, I just found out this library and jOOR. I really like your projects. I'd like it better if you guys could achieve "subclassing" interfaces and/or abstract classes using lambdas. This would be very helpful for using Java as an interpreted language.
Expected behavior and actual behavior:
I don't know whether similar functionalities exist. But this is what I expect:
Is this possible or already implemented? If not, can I request this functionality and/or help implement it? Thank you!
The text was updated successfully, but these errors were encountered: