Jeff Emanuel wrote:
 >>> x = getTargetArray("myBean","myCustom")
 >>> fooBean.setCustomBeans(x)

What happens if you print x? 
array([[Caching Stub]Proxy for mydomain:Name=key2,Type=JMSDestinationKey], management.CustomBean).
Yes it is of type management.CustomBean
It should tell you that
it is an array of some type.  What type is it?  The
conversion is failing because x is not the correct type.
The bean setter is looking for management.configuration.JMSDestinationKeyBean which extends management.CustomBean.
Looks like jython is unable to co-erce the super class to the child class. Is there a way to achieve this?

Thanks,
-satya
It looks like it should be, so is it possible that you have
two different CustomBean classes?  If the same class
is loaded by different classloaders, you get separate
incompatible classes.
 
 
 
-----Original Message-----
From: Satya Ghattu [mailto:sghattu@bea.com]
Sent: Thursday, October 23, 2003 8:37 PM
To: Jython-Users; Satya Ghattu
Subject: [Jython-users] co-erce a pyArray to object[]

Hello
I have a jython function:
def getTargetArray(type, values):
     return javaObj.getTargetArray(type, values)

The implementation of javaObj.getTargetArray(type,values) is something like this,

CustomBean[] getTargetArray(String type, String values) {
    CustomBean[] result = new CustomBean[2];
     String[] valuesArray = Utils.toArray(values);
    for (int i = 0; i < 2; i++) {
      result[i] = getCustomBean(type,valuesArray[i]);
    }
    return result;
  }

when I call.
when I try to do this I get this error,
Traceback (innermost last):
  File "<input>", line 1, in ?
TypeError: setCustomBeans(): 1st arg can't be coerced to management.configuration.CustomBean[]

Does any one how could I pass in a pyArray to my java bean's set method that takes a Object[] ?
I looked at the jython's jarray module but wasn't able to figure out how to do this.

Any pointers much appreciated, Thanks
-satya