jinterface - type conversion

Camilo Cerchiari camilo.cerchiari@REDACTED
Fri Jul 24 18:22:51 CEST 2009


hello all,

i'm starting to work with jinterface.  of course, one of the first things i
have to do is type conversion.
as i see, every OtpErlangObject subclass has its own conversion method,
returning different things.
for example OtpErlangList has the method elements returning
OtpErlangObject[], OtpErlangLong has longValue() returning a long, etc.
however there is no abstract function in the abstract class OtpErlangObject,
something like getValue().

my question is:  is there any reason for not having such an
OtpErlangObject.getValue() method?
of course, every subclass should implement this method, and this IMHO is the
best place to do it, OO speaking.

that method would be very usefull, as it would do the conversions from
erlang types to java classes, that otherwise should be done by the
programmer, in a not so elegant way.  even complex erlang variables (think
of lists of tuples of lists...) would be transformed trivially into java
similars.


comments on this will be appreciated,
salutes,
Camilo


More information about the erlang-questions mailing list