How to invoke java method

Best practices, code snippets for common functionality, examples, and guidelines.
User avatar
Support Team
Site Admin
Site Admin
Posts: 12145
Joined: Fri Jul 07, 2006 4:30 pm
Location: Houston, Texas, USA
Contact:

Re: How to invoke java method

Post by Support Team » Thu May 24, 2012 3:05 pm

Hi,

Do you have tried to cast it to a JavaObjectWrapper array or to access one array item by array item?

Regards,
Markus
Ranorex Support Team

Prad
Posts: 12
Joined: Tue Feb 21, 2012 11:50 pm

Re: How to invoke java method

Post by Prad » Tue May 29, 2012 5:00 pm

Hi ,

How can i cast / convert it to an array if the returned object is only a single instance
of the JavaObjectWrapper ,

Regards,
Prad

User avatar
Support Team
Site Admin
Site Admin
Posts: 12145
Joined: Fri Jul 07, 2006 4:30 pm
Location: Houston, Texas, USA
Contact:

Re: How to invoke java method

Post by Support Team » Wed May 30, 2012 7:17 pm

Hi,

But you wrote the return value is an array of class instances?
Could you describe it more detailed or could you send us a sample which illustrates your problem?

Regards,
Markus
Ranorex Support Team

Prad
Posts: 12
Joined: Tue Feb 21, 2012 11:50 pm

Re: How to invoke java method

Post by Prad » Mon Jun 04, 2012 3:35 pm

Hi ,

This is the error that i encounter when i try to cast the return value to a JavaObjectWrapper array ,

System.InvalidCastException: Unable to cast object of type 'Ranorex.Plugin.JavaObjectWrapper' to type 'Ranorex.Plugin.JavaObjectWrapper[]'.

the situation where i encounter this , i am trying to access an object in a private object that would return the objects in a table and the corresponding sort order

and this this return value indicating that an array is returned , [Lcom.corp.nms.ui.common.generic.table.BaseTableColumn;@5df0733a

but cannot iterate through the elements in the array since the return value is a single instance of the JavaObjectWrapper

please advice

Regards,
Pradeep

User avatar
Support Team
Site Admin
Site Admin
Posts: 12145
Joined: Fri Jul 07, 2006 4:30 pm
Location: Houston, Texas, USA
Contact:

Re: How to invoke java method

Post by Support Team » Tue Jun 05, 2012 5:06 pm

Hi Prad,

Do your table has a method which return just the elements in your table?
Do you have tried casting it to a normal "JavaObjectWrapper" and then to invoke a method, if there is one, which return just the data of the table, like a getter?
It would help us solving the issue if you can send ([email protected]) or post us the used RxCode and your Java Sample?

Regards,
Markus
Ranorex Support Team