ASPN ActiveState Programmer Network
ActiveState
/ Home / Perl / PHP / Python / Tcl / XSLT /
/ Safari / My ASPN /
Cookbooks | Documentation | Mailing Lists | Modules | News Feeds | Products | User Groups


Recent Messages
List Archives
About the List
List Leaders
Subscription Options

View Subscriptions
Help

View by Topic
ActiveState
.NET Framework
Open Source
Perl
PHP
Python
Tcl
Web Services
XML & XSLT

View by Category
Database
General
SOAP
System Administration
Tools
User Interfaces
Web Programming
XML Programming


MyASPN >> Mail Archive >> Jython-users
Jython-users
Re: [Jython-users] How to invoked a class main method ...
by Jeff Emanuel other posts by this author
Dec 9 2004 4:11PM messages near this date
[Jython-users] How to invoked a class main method ... | Re: [Jython-users] How to invoked a class main method ...
> In the same idea, I have method that accepts an Object[] (array of Objects).
> How do I invoke it from Jython... I tried a List ... Unsuccessfully !


You can pass a Jython list to a method that takes an Object[].  For 
example, java.util.Arrays.asList
takes an Object[]:

Jython 2.1 on java1.4.2_06 (JIT: null)
Type "copyright", "credits" or "license" for more information.
 > >> import java
 > >> o1=java.lang.Object()
 > >> o2=java.lang.Object()
 > >> l=java.util.Arrays.asList([o1,o2])
 > >> l.class
<jclass java.util.Arrays.ArrayList at 2954511> 
 > >> print l
[java.lang.Object@1eb62b6, java.lang.Object@9da1dd]
 > >>

The elements of the list don't even need to be Objects:

 > >> l=java.util.Arrays.asList([1,2])
 > >> l=java.util.Arrays.asList(['foo','bar'])




-------------------------------------------------------
SF email is sponsored by - The IT Product Guide
Read honest & candid reviews on hundreds of IT Products from real users.
Discover which products truly live up to the hype. Start reading now. 
http://productguide.itmanagersjournal.com/
_______________________________________________
Jython-users mailing list
Jython-users@[...].net
https://lists.sourceforge.net/lists/listinfo/jython-users
Thread:
Thomas SMETS
Jeff Emanuel
Kent Johnson

Privacy Policy | Email Opt-out | Feedback | Syndication
© 2004 ActiveState, a division of Sophos All rights reserved