Abbett, Jonathan wrote:
>> A method I use returns a "List" of objects. I, with my developer's
>> omniscience, know that each object in the list is of a particular class.
>> How do I cast my object to that class?
I don't have very much experience with the java bridge, but as far as I
know you don't need to cast java objects in php.
>> The Java code I'm basing this on simply looks like:
>>
>> List fooList = getFooList();
>> MyClass foo = (MyClass)fooList.get(0);
>>
>>
>> I'm stumped as to write the PHP analog.
My guess:
$SomeObject = java('full.package.path.to.SomeObject');
$fooList = $SomeObject->getFooList();
$foo = $fooList->get(0);
_Should_ be as simple as that.
I hope I could help,
Thomas
|