Beefy Boxes and Bandwidth Generously Provided by pair Networks
laziness, impatience, and hubris
 
PerlMonks  

Passing Java Classes as Parameters

by DanEllison (Sexton)
on Feb 08, 2012 at 19:24 UTC ( #952563=perlquestion: print w/ replies, xml ) Need Help??
DanEllison has asked for the wisdom of the Perl Monks concerning the following question:

I'm using Inline::Java to interface with a commercial Java API. Everything is working real well. However, I've run into a couple of methods that expect a class to be passed instead of a simple object. For example I have a Java method defined like:

public java.util.List list(java.lang.Class jClass) { ... }

The list method returns a list of all objects of class jClass that are associated to the method's object (jObject).

How can I call the method from perl and specify a class as the parameter?

I know that this works:

my $jSubObject = new com::myco::jSubClass(); my $list = $jObject->list($jSubObject->getClass());

But obviously, I don't want to define a new object just to get it's class.

Comment on Passing Java Classes as Parameters
Select or Download Code

Log In?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: perlquestion [id://952563]
Approved by davido
Front-paged by Old_Gray_Bear
help
Chatterbox?
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others perusing the Monastery: (4)
As of 2014-09-02 00:41 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    My favorite cookbook is:










    Results (18 votes), past polls