[jdom-interest] instanceof

Syloke Soong ssoong at protedyne.com
Mon Jan 22 14:21:24 PST 2007

Another addendum.

The hypothetical code I wrote is erroneous, because I don't have a way
to translate the content class provided by getContentType() into a
polymorphic call. 

Perhaps like getContentType().newInstance(), which means that all
Content objects would need to have a reflective newInstance() method to
produce the polymorphic signature cheating flag.

Still, I persist that using a polymorphic signature cheating flag is
nonetheless cheating. It exploits polymorphic registry of the platform
to allow the method to pretend it is polymorphic.

In the following (Text e) and (Element e) are used as the polymorphic
signature cheating flags and Object o is the actual Object to be

[hypothetical code]
    Content citrus = citr.next();
    Consume(citrus.getContentType().newInstance(), citrus);

public Consume(Text e, Object o){...}
public Consume(Element e, Object o){...}
[/hypothetical code]

This email and any files transmitted with it are confidential and intended solely for the use of the individual or entity to whom they are addressed. If you have received this email in error please notify the sender immediately. Please note that any views or opinions presented in this email are solely those of the author and do not necessarily represent those of the company. Even though this company takes every precaution to ensure this email is virus-free, the recipient should check this email and any attachments for the presence of viruses. The company accepts no liability for any damage caused by any virus transmitted by this email.
Protedyne Corporation, 1000 Day Hill Rd, Windsor, CT 06095, USA,                                                                  

More information about the jdom-interest mailing list