PDA

View Full Version : Accessing Java subclasses from Quercus


OCTAGRAM2
05-31-2011, 04:55 PM
In Java we have

transport.sendMessage(message,
message.getRecipients(Message.RecipientType.TO));


How does it supposed to be translated to Quercus?

I can't easily (without reflection) access Message.RecipientType subclass. I've tried so far:

java_class('javax.mail.Message.RecipientType')
java_class('javax.mail.Message')->RecipientType
java_class('javax.mail.Message')->RecipientType()
java_class('javax.mail.Message')::RecipientType
java_class('javax.mail.Message')['RecipientType']

domdorn
06-02-2011, 07:19 PM
take a look at this thread, it should provide the answer you're looking for
http://forum.caucho.com/showpost.php?p=32756&postcount=4

jacob11
04-17-2012, 08:13 PM
You can cast the parameter to the subclass so that members and methods of the subclass can be called. But...

A method's parameters ought to reflect the type of thing that the method expects to be called with. So if the method is going to access things which are proper to the subclass then the parameter ought to express that fact and have the type of the subclass.

gaulrobe
05-15-2012, 02:27 PM
It seems easy enough to use static subclasses, but what about using non-static subclasses?

public class outer {

...

public class inner {

...

}

}

I always get 'null' when I try to access 'inner'. Is this a bug within Quercus?