Sean,

You have found a nice bug.  Thanks for the easy to reproduce example.

I have tracked down the bug and I think it has really nothing  to do with
inner classes.  The problem is that entrySet()->toArray() returns an array
of Objects, each object of type java.util.HashMap$Entry. But
java.util.HashMap$Entry is NOT a public class. So therefore I can't
manipulate it as easily using reflexion.

What I think I need to do is treat it as a java.util.Map$Entry, which is a
public interface. I'll see how I can acheive this.

Thanks,

Patrick




Patrick LeBoutillier wrote:

Sean,

That's a great question and to be frank I have never tried to do that. I'll investigate
and let you know what comes up.


Patrick


Slotterback, Sean wrote:

Sorry if this is a bit of a newbie question, but what is the procedure for accessing methods of Inner classes in Inline::Java? I am fine if I am actually instantiating the Inner class from scratch as shown on the website, but I can't seem to access ones that have already been instantiated. The below example illustrates

#! /usr/local/bin/perl
use strict;
use warnings;

use Inline (
     Java => 'STUDY',
     STUDY => ['java.util.HashMap'],
        AUTOSTUDY => 1,
  ) ;

my $hm = new java::util::HashMap() ;
$hm->put("key", "value") ;
my $valArr = $hm->entrySet->toArray();

for (my $i = 0; $i < $valArr->length(); $i++)
{
   print $valArr->[$i]->getKey() . "\n";
}

Any help would be much appreciated.

Thanks and Regards,
Sean






--
=====================
Patrick LeBoutillier
Laval, Quebec, Canada



Reply via email to