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

Integer[][].class

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

I will give it a try.

Thank you very much

Nicola


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
c=Foo.getArrayClass(java.lang.Integer)
print c
        
[Ljava.lang.Integer;
  
print c.isArray()
        
1
  
print c.componentType
        
java.lang.Integer


-----Original Message-----
From: Nicola de Candussio [mailto:ndecandu@rssd.esa.int]
Sent: Tuesday, February 03, 2004 2:00 AM
To: jython-users@lists.sourceforge.net
Subject: [Jython-users] Array class instances


Hi all,

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

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 !!
a.getClass()

any suggestion ???

Thanks in advance


Nicola



-------------------------------------------------------
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.
http://www.eclipsecon.org/osdn
_______________________________________________
Jython-users mailing list
Jython-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/jython-users