It works but it must be extended to cover array definitions as the following


maybe using
Array.newInstance(Class componentType,  int[] dimensions)

I will give it a try.

Thank you very much


Jeff Emanuel wrote:
I haven't found a way to do it directly from Jython.  How
about a little java helper function?

import java.lang.reflect.Array;
public class Foo{
  public static Class getArrayClass(Class c) {
    return Array.newInstance(c,0).getClass();

import java,Foo
print c
print c.isArray()
print c.componentType

-----Original Message-----
From: Nicola de Candussio []
Sent: Tuesday, February 03, 2004 2:00 AM
Subject: [Jython-users] Array class instances

Hi all,

do you now if it is possible to generate the equivalent of this java 

Class i = Integer[].class

in jython ??
i.e. is it possible to generate instances of  java.lang.Class ?
the following

from java.lang import Integer
i = Integer[]

does not work .....

Trying to get an object of that type and access its class definition 
does not work either

from java.lang.reflect import Array
a = Array.newInstance(Integer, 1)
# NO !!

any suggestion ???

Thanks in advance


The SF.Net email is sponsored by EclipseCon 2004
Premiere Conference on Open Tools Development and Integration
See the breadth of Eclipse activity. February 3-5 in Anaheim, CA.
Jython-users mailing list