Alessio Stalla alessiostalla@gmail.com writes:
On Sat, Jun 12, 2010 at 3:40 PM, Mario Lang mlang@delysid.org wrote:
Just stumbled across this one when I tried to use STRING-EQUAL to compare a value I received via JINTERFACE-IMPLEMENTATION.
Now, it appears to be very simple to allow the expression
(string (jnew "java.lang.String" "foo"))
by overriding STRING() in JavaObject and checking if obj is a (java) String.
What do you think?
I think it would be a valuable addition, but why limit it to Strings? (string java-object) could always return the result of calling toString() on the wrapped object, or "null" when it's null.
Thats certainly an option, but I didn't want to make the initial proposal to broad. :-) toString() is a method of java.lang.Object, so JavaObject#STRING could indeed just call toString without checking for the class of obj. In fact, the more I think of it the better it sounds.
If there is consensus, I can prepare an update patch if need be (its simple enough anyways).